[cfe-commits] [PATCH][PR11329][v3] Generalize -Wempty-body: warn when statement body is a empty
Anna Zaks
ganna at apple.com
Wed Jan 4 17:23:40 PST 2012
On Jan 4, 2012, at 5:10 PM, Dmitri Gribenko wrote:
> Hello,
>
> Attached is a patch that implements enhancement proposed in PR11329.
>
> 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?
Thanks fro working on this!
Anna.
> I've measured clang self-build time with and without the patch, time
> difference is on order of measurement error.
>
> Commit message:
> Generalize -Wempty-body to warn about empty body in for, range-based
> for, while and switch statements.
>
> 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>*/
> <generalize-warn-empty-body-v3.patch>_______________________________________________
> 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