This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Implement -Wswitch-fallthrough


On Mon, Jul 11, 2016 at 10:08:02PM +0200, Eric Botcazou wrote:
> > After I'd completed the warning, I kicked off a bootstrap so as to add
> > various gcc_fallthrough calls.  There were a good amount of them, as
> > expected.  I also grepped various FALLTHRU/Falls through/...fall
> > thru.../... comments in config/ and added gcc_fallthroughs to make it
> > easier for people.  Wherever I wasn't sure that the gcc_fallthrough was
> > appropriate, I added an 'XXX' comment.  This must not be relied upon as I
> > don't know most of the compiler code.  The same goes for relevant libraries
> > where I introduced various gomp_fallthrough macros conditional on __GNUC__
> > (I'd tried to use a configure check but then decided I won't put up with
> > all the vagaries of autoconf).
> 
> Do we really want to clutter up the entire tree like that?  The result is 
> particularly ugly IMO.  Just add -Wno-switch-fallthrough somewhere I'd say.

Well, we already have the /* FALLTHRU */ etc. comments in most of the
places.  Perhaps if we replace those comments just with GCC_FALLTHRU,
a macro that expands to __builtin_fallthrough (); for GCC >= 7, or
to [[fallthrough]] for C++17, or nothing?
IMHO it doesn't make sense to keep both the gomp_fallthrough (); macro and
/* FALLTHROUGH */ etc. comments in the source.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]