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: Implement -Wswitch-fallthrough




On 07/12/2016 04:14 PM, Jakub Jelinek wrote:
On Tue, Jul 12, 2016 at 04:08:02PM +0200, Marek Polacek wrote:
On Tue, Jul 12, 2016 at 09:57:01AM -0400, NightStrike wrote:
From http://security.coverity.com/blog/2013/Sep/gimme-a-break.html:

Thanks, this is useful.

We also suppress a case label if there is a comment that matches
[^#]fall.?thro?u, even if it's not on the last line.

Our current plan is to handle sth like
[ \t]*FALL(S | |-)?THR(OUGH|U)\.?[ \t]*
[ \t]*Fall(s | |-)?[Tt]hr(ough|u)\.?[ \t]*
[ \t]*fall(s | |-)?thr(ough|u)\.?[ \t]*

And
/*-fallthrough*/
/*@fallthrough@*/
//-fallthrough
//@fallthrough@
(those 4 as standardized lint comments only in lowercase, the
above regexps are meant to match the whole comment content, i.e.
everything between /* and */ or // and \n.

I think this approach is doomed to fail, because it takes only one language into account, and fails with preprocessed sources.


Bernd


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