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: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}


On 2016.10.12 at 12:26 +0200, Jakub Jelinek wrote:
> On Wed, Oct 12, 2016 at 11:52:02AM +0200, Bernd Schmidt wrote:
> > 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.
> 
> What do you mean at most?  level 0 is the warning disabled, that is the
> default except for -Wextra.  The difference between =1 and =2 is very small
> amount of warnings, one will need to annotate or add break; to those 951
> spots anyway to make it -Wextra clean (those that don't have any kind of
> comment at all), so just handling the additional 136 ones as well is not
> that big deal.  It would be interesting to see those 136 comments though,
> whether anything in them is about the intentional fall through or if they
> are just unrelated.

Here are some examples:

 /* Don't break */
 /* drop through */      //very popular
 /* fall though */ 
 /* pass through... */
 /* break intentionally omitted */ 
 /* fallthough */
 /* Don't break, this is a failed frame! */
 /* leave break out intentionly */ 
 /* else: Fall trough */  
 /* passthrough */ 
 /* NOBREAK */
 /* follow thru */ 
 /* go through here */ 

-- 
Markus


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