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

Nico Weber thakis at chromium.org
Tue Jan 10 15:20:25 PST 2012


>> 2.) It would be nice if -Wempty-body for if statements would also
>> print this new note – it looks like it's only printed for loops at the
>> moment.
>
> Moving `;' on a new line doesn't silence the warning for `if', because
> `if(...);' doesn't make sense.  `if(...) assert(...);' preprocesses to
> `if(...) (void) 0;', so this idiom is not affected.

It could suggest using {} instead of ; though (which also silences the
other warning) :-) But as I said, both points are optional, and I
don't feel strongly about either.

Nico




More information about the cfe-commits mailing list