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

Dmitri Gribenko gribozavr at gmail.com
Wed Jan 4 11:14:11 PST 2012


On Wed, Jan 4, 2012 at 9:03 PM, Nico Weber <thakis at chromium.org> wrote:
> On Wed, Jan 4, 2012 at 8:52 AM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> It finds many false positives,

To reduce false positives we can emit diagnostic only if the semicolon
is in the next column after the closing parenthesis:
for(...);

> Since this pattern is apparently
> often used intentionally I'm not sure if this is a useful warning in
> practice.

It is implemented in commercial static analyzers, so I think it is
useful.  My implementation just catches too many cases.

> ps: I can send you the build output if you want to look over it.

Yes, please.

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