[PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}

Bernd Schmidt bschmidt@redhat.com
Wed Oct 12 09:52:00 GMT 2016

On 10/12/2016 11:31 AM, Markus Trippelsdorf wrote:
> On 2016.10.12 at 00:34 +0200, Bernd Schmidt wrote:
>> It's a discussion we should have, but I agree it should be done
>> incrementally. I would argue for =1 as the default.
> Here are some numbers for an allmodconfig Linux kernel on pcc64le:
> -Wimplicit-fallthrough=1 :  951 warnings
> -Wimplicit-fallthrough=2 : 1087 warnings
> -Wimplicit-fallthrough=3 : 1209 warnings
> I randomly looked at the differences and almost all additional
> -Wimplicit-fallthrough=2 warnings are bogus (~5% are genuine).
> And _all_ additional -Wimplicit-fallthrough=3 warnings appear
> to be bogus.

And that's for a codebase that was written in English to begin with. 
Would you mind posting one or two examples if you saw interesting ones, 
for reference?

This result suggests that we should probably collapse levels 3-5 into a 
single strict one that doesn't try to be clever, and definitely make at 
most level 1 the default.

Another thing, was it ever resolved what this warning does to tools like 
ccache which like to operate on preprocessed files?


More information about the Gcc-patches mailing list