[PATCH] cpp/c: Add -Wexpansion-to-defined

Paolo Bonzini bonzini@gnu.org
Wed Aug 10 08:45:00 GMT 2016



On 10/08/2016 02:48, Manuel López-Ibáñez wrote:
> TL;DR If the warning is enabled by -Wpedantic, it should be an error
> with -Werror=pedantic and it should use cpp_pedwarning. Whether it
> should be enabled by -Wpedantic is more difficult to say.
> 
> -pedantic is equivalent to -Wpedantic. If -Wx is enabled by -Wy, then
> -Werror=y implies -Werror=x. Every warning enabled by -Wpedantic works
> in the same way and I don't see why this one should be different.
> 
> Moreover, I think that this was a latent bug in libcpp: the code
> should have used cpp_pedwarning instead of cpp_warning. This is
> https://gcc.gnu.org/PR66505
> Quoting https://gcc.gnu.org/wiki/DiagnosticsGuidelines#Types_of_diagnostics
> : "The same rules apply to libcpp, which uses cpp_pedwarning (instead
> of pedwarn), CPP_PEDANTIC (pfile) (instead of pedantic) and
> CPP_W_PEDANTIC (instead of OPT_Wpedantic). In particular, you may use
> cpp_pedwarning without CPP_W_PEDANTIC, but you may not use
> CPP_W_PEDANTIC without cpp_pedwarning and you may not use CPP_PEDANTIC
> (pfile) without CPP_W_PEDANTIC."

But pedwarns are for errors mandated by the standard; this one is not.
Let's just move it from -Wpedantic to -Wextra.

Paolo



More information about the Gcc-patches mailing list