[Bug c++/52961] Make -Wempty-body less noisy and enable it with -Wall
manu at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Nov 12 15:06:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52961
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Missing warning on empty if |Make -Wempty-body less
| |noisy and enable it with
| |-Wall
--- Comment #10 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
This warning is too noisy because it warns for:
if(a)
;
return 2;
which is often the result of macro expansion. Clang specifically does not warn
for this and suggests placing the ";" on a different line to silence the
warning:
warning: if statement has empty body [-Wempty-body]
if(a);
^
note: put the semicolon on a separate line to silence this warning
which seems a nicer way to silence the warning instead of ugly { ; }
More information about the Gcc-bugs
mailing list