This is the mail archive of the
mailing list for the GCC project.
Re: Implement -Wswitch-fallthrough
On Mon, Jul 11, 2016 at 4:34 PM, Jakub Jelinek <firstname.lastname@example.org> 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 */
> (and say:
> /* FALL THROUGH */
> /* FALLTHRU */
> /* FALL THRU */
> /* Fallthrough */
> /* Fall through */
> /* Fallthru */
> /* Fall thru */
> /* fallthrough */
> /* fall through */
> /* fallthru */
> /* fall thru */
> // FALLTHROUGH
> // FALL THROUGH
> // FALLTHRU
> // FALL THRU
> // Fallthrough
> // Fall through
> // Fallthru
> // Fall thru
> // fallthrough
> // fall through
> // fallthru
> // fall thru
We also suppress a case label if there is a comment that matches
[^#]fall.?thro?u, even if it's not on the last line.
Maybe that's enough?
The page has other exclusions that might be desirable.