This is the mail archive of the
mailing list for the elfutils project.
Re: [PATCH v2] Add fallthrough attributes
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.