This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- From: Markus Trippelsdorf <markus at trippelsdorf dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Bernd Schmidt <bschmidt at redhat dot com>, Marek Polacek <polacek at redhat dot com>, Jason Merrill <jason at redhat dot com>, "Joseph S. Myers" <joseph at codesourcery dot com>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 12 Oct 2016 12:36:29 +0200
- Subject: Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- Authentication-results: sourceware.org; auth=none
- References: <20161011215238.GF7282@tucnak.redhat.com> <0f10a8ce-fcb1-b2c5-9012-f94ce518c422@redhat.com> <20161012093149.GB307@x4> <c2539fac-a4c8-31b7-7973-75dcc5d6b450@redhat.com> <20161012102657.GM7282@tucnak.redhat.com>
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
- Follow-Ups:
- Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- References:
- [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- From: Markus Trippelsdorf
- Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}
- Re: [PATCH] Introduce -Wimplicit-fallthrough={0,1,2,3,4,5}