Hi, On Sun, 16 Dec 2018, Oliver Smith wrote: > When using GCC8.2, since --enable-debug treats warnings as errors, the > compiler detects that a switch/case is falling through. > > Since the fallthrough is intentional, we apply the attribute to indicate > to the compiler that this is correct behaviour. But that'd restrict us to compile with gcc 8.2 or above only. Backward compatibility must be taken care of in include/libipset/compat.h, like #if defined(__GNUC__) && __GNUC__ >= 7 #define FALL_THROUGH __attribute__ ((fallthrough)); #else #define FALL_THROUGH #endif /* __GNUC__ >= 7 */ Also, I'm surprised that gcc warns only at this spot: there are a couple of other intentional (and documented thus) fall through cases. Those should be guarded as well. Best regards, Jozsef > Signed-off-by: Oliver Smith <oliver@xxxxxxxxxxxxxx> > --- > lib/ipset.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/ipset.c b/lib/ipset.c > index 4366e60..e5c7bda 100644 > --- a/lib/ipset.c > +++ b/lib/ipset.c > @@ -1208,6 +1208,7 @@ ipset_parse_argv(struct ipset *ipset, int oargc, char *oargv[]) > return ret; > } > /* Fall through to parse optional setname */ > + __attribute__ ((fallthrough)); > case IPSET_CMD_DESTROY: > case IPSET_CMD_FLUSH: > /* Args: [setname] */ > -- > 2.19.2 > > - E-mail : kadlec@xxxxxxxxxxxxxxxxx, kadlecsik.jozsef@xxxxxxxxxxxxx PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt Address : Wigner Research Centre for Physics, Hungarian Academy of Sciences H-1525 Budapest 114, POB. 49, Hungary