>From 8d5324941f8f88f2559f93dfbfc169383c167d0a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 19 Sep 2017 10:00:35 -0700 Subject: [PATCH 3/7] maint: port to GCC 7.2 * configure.ac (WERROR_CFLAGS): Avoid -Wduplicated-branches. * tailor.h (FALLTHROUGH): New macro, taken from Emacs. * gzip.c (main): Use it. --- configure.ac | 1 + gzip.c | 2 +- tailor.h | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 05aa681..ca4066c 100644 --- a/configure.ac +++ b/configure.ac @@ -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 3d2aeaf..32a229c 100644 --- 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'; diff --git a/tailor.h b/tailor.h index 8510599..aec3029 100644 --- a/tailor.h +++ b/tailor.h @@ -202,3 +202,11 @@ #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 -- 2.13.5