[PATCH v2] Add fallthrough attributes
Fri Feb 9 09:27:00 GMT 2018
On Fri, Feb 09, 2018 at 10:08:09AM +0100, Ulf Hermann wrote:
> > [...]
> > +#ifdef HAVE_FALLTHROUGH
> > + __attribute__ ((fallthrough));
> > +#endif
> > [...]
> I would like to see this stanza wrapped in a macro, so that we only have one "#ifdef HAVE_FALLTHROUGH" in the code, not another one in every place we want to fall through. See the "internal_function" macro defined in lib/eu-config.h for a similar case.
Agreed. Having 4 lines for a fallthrough instead of 1 is really too
much. Also could you explain a bit more why you would like this?
The advantage of the comments really is that they should work
If the comment really doesn't work in your situation maybe we could do
like gnulib did:
The idea is that those versions of GCC that support
-Wimplicit-fallthrough also have support for the __attribute__
((fallthrough)) statement. So they can always be used together.
More information about the Elfutils-devel