[cfe-commits] [PATCH][PR11329][v3] Generalize -Wempty-body: warn when statement body is a empty

David Blaikie dblaikie at gmail.com
Thu Jan 5 11:46:49 PST 2012


If your have a specific other static analysis tool in mind - perhaps
it'd be worth running some similar tests against that tool to see what
heuristics it uses. It might give you a better idea of what cases are
more likely to be with catching and what aren't (not that it is in any
way definitive - this other tool could be unacceptably
noisy/stylistically pedantic or too conservative)
From: Dmitri Gribenko
Sent: 1/5/2012 7:29 AM
To: Anna Zaks
Cc: cfe-commits at cs.uiuc.edu
Subject: Re: [cfe-commits] [PATCH][PR11329][v3] Generalize
-Wempty-body: warn when statement body is a empty
On Thu, Jan 5, 2012 at 3:23 AM, Anna Zaks <ganna at apple.com> wrote:
> On Jan 4, 2012, at 5:10 PM, Dmitri Gribenko wrote:
>> Thanks to the reviewers' comments, I've implemented the following
>> heuristic.  For and while with null statement as a body should be
>> followed by a CompoundStmt in order to emit a warning.  This turned
>> out to be sufficient to silence all warnings in llvm and clang
>> codebase.  Fixes to the testsuite are also reduced.
>
> Does this also silence the chromium false positives that Nico previously mentioned?

Yes, all of them.  But this limits the warning to for();{} cases.  I'm
now trying another (additional) heuristic, will post the results in a
few hours (chromium takes a while to compile).

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

_______________________________________________
cfe-commits mailing list
cfe-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list