[PATCH] Fix -Wimplicit-fallthrough -C, handle some more comment styles and comments in between FALLTHRU comment and label

Jakub Jelinek jakub@redhat.com
Sat Oct 1 08:54:00 GMT 2016

On Sat, Oct 01, 2016 at 10:49:03AM +0200, Eric Botcazou wrote:
> > See Tom Tromey's explanation why accepting too much is bad (at least unless
> > we want multiple levels).
> Tom's changes made to GDB are IMO the perfect examples of what we don't want:
> -      /* ... fall through for unsigned ints ...  */
> +      /* fall through */
> -                /* For other instructions, fallthru.  */
> +                /* fallthru.  */
> -      /* fall thru to manual case */
> +      /* fall thru */
> So, because of its excessive pickiness, the warning ends up making the user 
> butcher informative comments.  How is that helpful?

Note, the wast majority of the fallthru comments are already recognized, it
is only when people start to write those in free form.
E.g. today I wanted to try Marek's testcase from some PR and have commented
out [[fallthrough]]; attribute - // [[fallthrough]];
if we are not picky enough, it will be handled as a valid fallthrough
comment, which might not be the intent.  The more this is discussed,
the more I lean towards the multiple levels of the warning, so that projects
can choose what exactly they want, starting with only allowing attributes,
down to accepting any comments whatsoever.


More information about the Gcc-patches mailing list