On 19/05/21 17:50 +0100, Jonathan Wakely wrote:
On 19/05/21 12:40 -0400, Eric Gallager wrote:
Thank you for doing this! One thing I'm wondering about, is that I'm
pretty sure clang also allows at least some of these to be used with
plain C as well, for example for things like the old use of "auto" in
C conflicting with the newer C++11 meaning of "auto". Would it be
possible to do likewise for GCC as well? Just an idea.
I think that would belong in -Wc++-compat and would need changes to
the C front end, which I'm almost entirely unfamiliar with. My patch
doesn't add any new diagnostics, it just makes slight adjustments to
existing ones. If you want new diagnostics in the C front end you'll
need to convince a C FE maintainer. That would be too far outside my
comfort zone :-)
FWIW, Clang does accept -Wc++11-extensions as an option for the C
compiler, but I think that's true for all its warning options (I don't
think it ever rejects a warning option as "valid for C++ but not for
C" the way that GCC does). But I can't persuade it to warn about using
'auto' in C, even with -Weverything.