This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Implement -Wimplicit-fallthrough (version 9)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: Jason Merrill <jason at redhat dot com>, Michael Matz <matz at suse dot de>, Bernd Schmidt <bschmidt at redhat dot com>, Richard Biener <richard dot guenther at gmail dot com>, Eric Botcazou <ebotcazou at adacore dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Markus Trippelsdorf <markus at trippelsdorf dot de>, Rainer Orth <ro at cebitec dot uni-bielefeld dot de>, Joseph Myers <joseph at codesourcery dot com>, Arnaud Charlet <charlet at adacore dot com>
- Date: Tue, 27 Sep 2016 17:04:23 +0200
- Subject: Re: Implement -Wimplicit-fallthrough (version 9)
- Authentication-results: sourceware.org; auth=none
- References: <CAFiYyc1ksRqxR81Q5fbeQ+sRpDsVN2qqVLfmf7W54LX50V-C-Q@mail.gmail.com> <a84b88e9-d6bd-31f4-a33e-1104531d7a22@redhat.com> <20160927115153.GU3223@redhat.com> <8521f44d-616c-a03d-879d-c400b13ce9d9@redhat.com> <20160927120108.GV3223@redhat.com> <6b5dbab6-0b5a-3f55-53e0-5dc419a3cd6a@redhat.com> <20160927134914.GW7282@tucnak.redhat.com> <alpine.LSU.2.20.1609271553120.5714@wotan.suse.de> <CADzB+2nbTbV=XWPRPFK6CSgsZoAsUz+oostdvFnCAT=dG3hNfQ@mail.gmail.com> <20160927145428.GE3223@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Sep 27, 2016 at 04:54:28PM +0200, Marek Polacek wrote:
> On Tue, Sep 27, 2016 at 10:48:50AM -0400, Jason Merrill wrote:
> > On Tue, Sep 27, 2016 at 9:56 AM, Michael Matz <matz@suse.de> wrote:
> > > On Tue, 27 Sep 2016, Jakub Jelinek wrote:
> > >
> > >> Just compare that to the number of real bugs the warning found in gcc
> > >> codebase. It is really worth it for -Wextra.
> > >
> > > All those bugs would also have been found as well when it had simply
> > > accepted
> > > /fall.*thr/i
> > > anywhere in the preceding comment on one line. But all the recent
> > > spelling changes of comments to cater for the strictness exactly shows how
> > > misguided that is. The above would accept "Don't fall through" as well.
> > > I say: so what?
> >
> > I agree.
>
> All right, I'm not opposed to making the comment parsing more benevolent.
> We still should have enough time to fine-tune it.
Perhaps we want -Wimplicit-fallthrough{,=1,=2,=3,=4}, where
=1 would match indeed /fall.*thr/i (note, it will be really costly in this
case, one will have to parse all comments in detail in the preprocessor,
so I'd be against making it the default), =2 would allow
what we do right now, perhaps with the optional else and dots (perhaps
selected other interpunction chars), =3 would only allow the standardized
lint comments and =4 would not allow any comments, just the attributes?
Then each project can choose what they want.
Jakub