RE: [PATCH] Use fall-through attribute rather than magic comments

From: David Laight
Date: Mon Jun 17 2019 - 12:46:18 EST


From: Joe Perches
> Sent: 17 June 2019 17:26
> On Mon, 2019-06-17 at 17:56 +0200, Pavel Machek wrote:
> > Hi!
> >
> > > +/*
> > > + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wimplicit-fallthrough
> > > + * gcc: https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
> > > + */
> > > +#if __has_attribute(__fallthrough__)
> > > +# define __fallthrough __attribute__((__fallthrough__))
> > > +#else
> > > +# define __fallthrough
> > > +#endif

Should the trailing ; be added to the above?
I think the above would require:
case foo:
bar();
__fallthrough;
case baz:

When commented out that leaves a completely empty statement (adjacent ;)
I'm sure some compilers complain about those as well.

David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)