@@ -368,6 +368,10 @@ if test "x$enable_werror" = "xyes"; then
368368 AX_CHECK_COMPILE_FLAG ( [ -Werror=date-time] ,[ ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=date-time"] ,,[ [ $CXXFLAG_WERROR] ] )
369369 AX_CHECK_COMPILE_FLAG ( [ -Werror=return-type] ,[ ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=return-type"] ,,[ [ $CXXFLAG_WERROR] ] )
370370 AX_CHECK_COMPILE_FLAG ( [ -Werror=conditional-uninitialized] ,[ ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=conditional-uninitialized"] ,,[ [ $CXXFLAG_WERROR] ] )
371+ dnl -Wsuggest-override is broken with GCC before 9.2
372+ dnl https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78010
373+ AX_CHECK_COMPILE_FLAG ( [ -Werror=suggest-override] ,[ ERROR_CXXFLAGS="$ERROR_CXXFLAGS -Werror=suggest-override"] ,,[ [ $CXXFLAG_WERROR] ] ,
374+ [ AC_LANG_SOURCE ( [ [ struct A { virtual void f(); }; struct B : A { void f() final; };] ] ) ] )
371375fi
372376
373377if test "x$CXXFLAGS_overridden" = "xno"; then
@@ -383,6 +387,8 @@ if test "x$CXXFLAGS_overridden" = "xno"; then
383387 AX_CHECK_COMPILE_FLAG ( [ -Wunused-variable] ,[ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wunused-variable"] ,,[ [ $CXXFLAG_WERROR] ] )
384388 AX_CHECK_COMPILE_FLAG ( [ -Wdate-time] ,[ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wdate-time"] ,,[ [ $CXXFLAG_WERROR] ] )
385389 AX_CHECK_COMPILE_FLAG ( [ -Wconditional-uninitialized] ,[ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wconditional-uninitialized"] ,,[ [ $CXXFLAG_WERROR] ] )
390+ AX_CHECK_COMPILE_FLAG ( [ -Wsuggest-override] ,[ WARN_CXXFLAGS="$WARN_CXXFLAGS -Wsuggest-override"] ,,[ [ $CXXFLAG_WERROR] ] ,
391+ [ AC_LANG_SOURCE ( [ [ struct A { virtual void f(); }; struct B : A { void f() final; };] ] ) ] )
386392
387393 # # Some compilers (gcc) ignore unknown -Wno-* options, but warn about all
388394 # # unknown options if any other warning is produced. Test the -Wfoo case, and
0 commit comments