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

Dmitri Gribenko gribozavr at gmail.com
Thu Jan 19 21:18:23 PST 2012


On Thu, Jan 19, 2012 at 1:11 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> Attached is a patch that implements enhancement proposed in PR11329.
>
> As suggested by Argyrios, this patch implements:
> * a stack of "CompoundScopeInfo"s, helper functions to push/pop them,
> ActOn{Start,Finish}OfCompoundStatement callbacks;
> * a check if the warning is actually enabled before doing costly checks.
>
> Doing this uncovered a bug in TreeTransfom, Sema::ActOnBlockError was
> not called in all cases.  This is also fixed.
>
> I've ran a chromium build again and found 3 false positives (-1
> because one previously affected file now builds with -Wno-empty-body).

I accidentally sent an old version with an error.  Here's a correct version.

Please review.

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>*/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: generalize-warn-empty-body-v8.patch
Type: text/x-patch
Size: 36417 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20120120/57cf3370/attachment.bin>


More information about the cfe-commits mailing list