maint: port to GCC 7.2
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 Sep 2017 17:00:35 +0000 (10:00 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 19 Sep 2017 17:43:51 +0000 (10:43 -0700)
* configure.ac (WERROR_CFLAGS): Avoid -Wduplicated-branches.
* tailor.h (FALLTHROUGH): New macro, taken from Emacs.
* gzip.c (main): Use it.

configure.ac
gzip.c
tailor.h

index 05aa68135dd81eabe31bf5f4c529caa90c362743..ca4066c4fbe52d779795a24147b88314d4558d39 100644 (file)
@@ -106,6 +106,7 @@ if test "$gl_gcc_warnings" = yes; then
   nw="$nw -Wtraditional"            # Warns on #elif which we use often
   nw="$nw -Wcast-qual"              # Too many warnings for now
   nw="$nw -Wconversion"             # Too many warnings for now
+  nw="$nw -Wduplicated-branches"    # Too many false alarms
   nw="$nw -Wsystem-headers"         # Don't let system headers trigger warnings
   nw="$nw -Wsign-conversion"        # Too many warnings for now
   nw="$nw -Wtraditional-conversion" # Too many warnings for now
diff --git a/gzip.c b/gzip.c
index 3d2aeafecc9674e9a76371198941846425545356..32a229c4e044a28a1b36e6e61fea47521b6c59b9 100644 (file)
--- a/gzip.c
+++ b/gzip.c
@@ -599,7 +599,7 @@ int main (int argc, char **argv)
         case '4' + ENV_OPTION:  case '5' + ENV_OPTION:  case '6' + ENV_OPTION:
         case '7' + ENV_OPTION:  case '8' + ENV_OPTION:  case '9' + ENV_OPTION:
             optc -= ENV_OPTION;
-            /* Fall through.  */
+            FALLTHROUGH;
         case '1':  case '2':  case '3':  case '4':
         case '5':  case '6':  case '7':  case '8':  case '9':
             level = optc - '0';
index 8510599e92c6b23fac5af809976a3b2a9a4abff3..aec30291c5b43ed10d3d35fbd843a2fe1a0edc9c 100644 (file)
--- a/tailor.h
+++ b/tailor.h
 #ifndef SET_BINARY_MODE
 #  define SET_BINARY_MODE(fd)
 #endif
+
+#ifndef FALLTHROUGH
+# if __GNUC__ < 7
+#  define FALLTHROUGH ((void) 0)
+# else
+#  define FALLTHROUGH __attribute__ ((__fallthrough__))
+# endif
+#endif