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 04:43:57PM -0400, David Malcolm wrote:
> On Mon, 2016-07-11 at 22:34 +0200, Jakub Jelinek wrote:
> > On Mon, Jul 11, 2016 at 10:23:30PM +0200, Marek Polacek wrote:
> > > On Mon, Jul 11, 2016 at 01:18:02PM -0700, Andi Kleen wrote:
> > > > > I explained why supporting the classic lint style comment
> > > > > wouldn't fly.
> > > > 
> > > > Not convincing, it worked fine for 30+ years of lints.
> > > 
> > > So how can the compiler handle
> > > /* Never ever fall through here */
> > > ?
> > 
> > It can't.  But it perhaps could handle a couple of documented most
> > common
> > comment styles, perhaps only if followed by break token, and turn say
> > /* FALLTHROUGH */
> > break
> 
> Presumably you mean "case" here?   A "break" token is surely the thing
> we're *not* expecting, right?

Sure, I meant case token.

> ...or maybe we could detect such comments and store, say, a bitmap of
> all source_location/location_t values at which we've seen a
> "fallthrough" style comment, and then have the warning code query this
> bitmap for a comment in the pertinent range.

It can be flag on the case token too.  The thing is if we care about
-save-temps, ccache, distcc and non-integrated preprocessing (I'm currently
trying to convince ccache to start using -fdirectives-only, but they don't
want to, see https://github.com/ccache/ccache/issues/93 for details).

	Jakub


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