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

Anna Zaks ganna at apple.com
Wed Jan 4 14:16:27 PST 2012


On Jan 4, 2012, at 1:25 PM, Dmitri Gribenko wrote:

> On Wed, Jan 4, 2012 at 11:17 PM, Anna Zaks <ganna at apple.com> wrote:
>> On Jan 4, 2012, at 11:44 AM, Dmitri Gribenko wrote:
>>> I agree that we might want to reduce false positive rate for `for' and
>>> `while' statements, but more elaborate ways (for example, checking if
>>> the statement is followed by a CompoundStmt) would require shifting
>>> this to static analyzer.
>> 
>> This would still be a syntactic check. Why can't it be part of sema checking?
> 
> Isn't that too much work for an on-by-default warning?
> 

Most likely not, though, it would be worth while measuring the impact after the work is done. (Also, I am not sure if the warning is/has to be on by default.)

I think, the main difficulty is to find out if we can come up with a set of heuristics which would preserve the usefulness of the warning and produce very little false alarms (for example, based on Nico's findings). 

Thanks,
Anna. 

> 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