bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Use -Wimplicit-fallthrough only with GCC >= 7


From: Jose E. Marchesi
Subject: [PATCH] Use -Wimplicit-fallthrough only with GCC >= 7
Date: Wed, 05 Jan 2022 19:32:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Hi people!

The -Wimplicit-fallthrough switch was introduced in GCC 7.

Older version of GCC (like 3 and 4) do not complain when they get passed
an invalid -WFOO option, but GCC 6 bails out like this:

  gcc: error: unrecognized command line option '-Wimplicit-fallthrough';
  did you mean '-Wno-fallthrough'?

diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4
index 179aac7aa1..62741f830f 100644
--- a/m4/gnulib-common.m4
+++ b/m4/gnulib-common.m4
@@ -896,7 +896,7 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
     dnl -Wno-conversion                       >= 3            >= 3.9
     dnl -Wno-float-conversion                 >= 4.9          >= 3.9
     dnl -Wno-float-equal                      >= 3            >= 3.9
-    dnl -Wimplicit-fallthrough                >= 3            >= 3.9
+    dnl -Wimplicit-fallthrough                >= 7            >= 3.9
     dnl -Wno-pedantic                         >= 4.8          >= 3.9
     dnl -Wno-sign-compare                     >= 3            >= 3.9
     dnl -Wno-sign-conversion                  >= 4.3          >= 3.9
@@ -911,12 +911,14 @@ AC_DEFUN([gl_CC_GNULIB_WARNINGS],
       -Wno-cast-qual
       -Wno-conversion
       -Wno-float-equal
-      -Wimplicit-fallthrough
       -Wno-sign-compare
       -Wno-undef
       -Wno-unused-function
       -Wno-unused-parameter
       #endif
+      #if __GNUC__ => 7 || (__clang_major__ + (__clang_minor__ >= 9) > 3)
+      -Wimplicit-fallthrough
+      #endif
       #if __GNUC__ + (__GNUC_MINOR__ >= 9) > 4 || (__clang_major__ + 
(__clang_minor__ >= 9) > 3)
       -Wno-float-conversion
       #endif




reply via email to

[Prev in Thread] Current Thread [Next in Thread]