This is the mail archive of the
mailing list for the GDB project.
Re: [C++] Warning Header Proposal
- From: Pedro Alves <palves at redhat dot com>
- To: Ben Longbons <brlongbons at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 16 Dec 2013 15:16:43 +0000
- Subject: Re: [C++] Warning Header Proposal
- Authentication-results: sourceware.org; auth=none
- References: <CA+XNFZNU8CQYnGoM-FvD9ya9rfoAUw7Mzr=eaUGU7uvWryOaNQ at mail dot gmail dot com>
On 12/14/2013 12:38 AM, Ben Longbons wrote:
> This is a somewhat controversial proposal, so I split it from the Attack Plan.
Yes, this looks quite orthogonal to C++ to me.
> The specific change I propose is, insteading of adding warnings by an
> autoconf test, hard-code them according to compiler version. Despite
> sounding like a step backward, this is actually a step forward,
I read the whole email, but I fear it still sounds a step backwards
> - I have a list of every single warning supported by gcc 4.6, 4.7, and
> 4.8 in C++ mode (the initial version of the file in C mode will be
> limited unless someone wants to fill it, but I don't see the point.
gnulib/manywarnings.m4 also has something like that, and that's
sure to be used by other GNU programs. If we were to change, I'd
rather see gnulib's warnings modules grow smart enough for our
use (if necessary) and switch to that.
> - Given the warning header, it very easy to flip one between "don't
> care", "ignore", "force to warning even with --enable-werror",
> "warning or error depending on --enable-werror", and "force error
"warning header" vs "warnings in command line" is
orthogonal to "decide which warnings to use based on version checks vs
"decide which warnings to use depending on autoconf tests". The latter
can just as well create a warning header.
> Currently, gdb enables
> very few compiler warnings. Hm, since the autoconf-added ones will be
> in the header anyway, is there a way to tell autoconf to *not* add
> -Wfoo to CPPFLAGS in gdb/ ?
No sure what you mean. There's -Wno-foo.
> - Compared to autoconf, we can rely on warnings actually *working*
> instead of just assuming that the option works just because the
> compiler recognizes it.
Sorry, that doesn't follow. We absolutely can test that the warning
actually works with autoconf. And that's something you can't do
with version checks. That's the sort of thing autoconf
is exactly meant for. The fact that we don't do it in this particular
case doesn't mean it can't be done.
> A particularly notorious example is -Wshadow,
> which is only useful since gcc 4.8 but has been recognized since
> (insert ridiculously ancient event here). Admittedly, it's *possible*
> to write a test for exactly the positive and negative cases, but are
> you really going to do that?