[cfe-commits] [PATCH][PR11329][v3] Generalize -Wempty-body: warn when statement body is a empty
    Dmitri Gribenko 
    gribozavr at gmail.com
       
    Thu Jan  5 09:23:05 PST 2012
    
    
  
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>*/
    
    
More information about the cfe-commits
mailing list