# HG changeset patch # User Rik # Date 1512683275 28800 # Node ID 268d31e7aa4f96c77a3ef1369b7bd48c168fc02e # Parent a164fd6e7e7b16232a42c6408828df3117b4df64 build: Silence compile warning about unknown GCC warning "-Wimplicit-fallthrough". * configure.ac: Check that compiler accepts "-Wimplicit-fallthrough" option. AC_DEFINE HAVE_WARNING_IMPLICIT_FALLTHROUGH if option is available. * lex.ll: Wrap "#pragma GCC diagnostic" code that uses "-Wimplicit-fallthrough" with "#if defined (HAVE_WARNING_IMPLICIT_FALLTHROUGH)"/"#endif". diff -r a164fd6e7e7b -r 268d31e7aa4f configure.ac --- a/configure.ac Thu Dec 07 15:40:43 2017 -0500 +++ b/configure.ac Thu Dec 07 13:47:55 2017 -0800 @@ -2929,7 +2929,14 @@ if test $octave_cv_gcc_has_pragma_GCC_diagnostic = yes; then AC_DEFINE(HAVE_PRAGMA_GCC_DIAGNOSTIC, 1, - [define if GCC supports @%:@pragma GCC diagnostic ...]) + [define if GCC supports @%:@pragma GCC diagnostic ...]) +fi + +## Check for one unusual warning used in pragmas that is not always available +if test $octave_cv_gcc_has_pragma_GCC_diagnostic = yes; then + OCTAVE_CC_FLAG([-Wimplicit-fallthrough], + [AC_DEFINE(HAVE_WARN_IMPLICIT_FALLTHROUGH, 1, + [define if GCC supports -Wimplicit-fallthrough warning])]) fi ### These are recommended by the gnulib bootstrap script: diff -r a164fd6e7e7b -r 268d31e7aa4f libinterp/parse-tree/lex.ll --- a/libinterp/parse-tree/lex.ll Thu Dec 07 15:40:43 2017 -0500 +++ b/libinterp/parse-tree/lex.ll Thu Dec 07 13:47:55 2017 -0800 @@ -47,7 +47,9 @@ #pragma GCC diagnostic ignored "-Wold-style-cast" #pragma GCC diagnostic ignored "-Wsign-compare" #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" -#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#if defined (HAVE_WARNING_IMPLICIT_FALLTHROUGH) +# pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif #endif