[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Enabling compiler warning flags
From: |
Jeffrey Walton |
Subject: |
Re: Enabling compiler warning flags |
Date: |
Mon, 25 Feb 2013 20:09:02 -0500 |
On Tue, Dec 18, 2012 at 12:28 AM, David A. Wheeler
<address@hidden> wrote:
> Jim Meyering said:
>> Did you realize that several GNU projects now enable virtually
>> every gcc warning that is available (even including those that
>> are new in the upcoming gcc-4.8, for folks that use bleeding edge gcc)
>> via gnulib's manywarnings.m4 configure-time tests?
>>
>> Of course, there is a list of warnings that we do disable,
>> due to their typical lack of utility and the invasiveness
>> of changes required do suppress them.
>
> Is there any way that the autoconf (or automake) folks could make compiler
> warnings much, much easier to enable? Preferably enabled by default when you
> start packaging something? For example, could gnulib warnings and
> manywarnings be distributed and enabled as *part* of autoconf? If not, could
> autoconf at least strongly advertize the existence of these, and include
> specific instructions to people on how to quickly install it? The autoconf
> section on "gnulib" never even *MENTIONS* the "warnings" and "manywarnings"
> stuff! And while automake has warnings, they are for the automake
> configuration file... not for compilation.
>
> Compiler warning flags cost nearly nothing to turn on when you're *starting*
> a project, but they're harder to enable later (a thousand warnings about the
> same thing later is harder than fixing it the first time). And while some
> warnings are nonsense, their use can make the resulting software much, much
> better. If we got people to turn on warning flags all over the place, during
> development, a lot of bugs would simply disappear.
>
GCC 4.8 added a couple of interesting flags
(http://gcc.gnu.org/gcc-4.8/changes.html): -fsanitize=address and
-fsanitize=thread. Some reading about them is available at
http://llvm.org/devmtg/2012-11/Serebryany_TSan-MSan.pdf.
It might be helpful to projects if the auto tools enabled one or both
by default. The overhead on Address Sanitizer looks small compared to
the payoff.
Also, the new -Og requires a debug level (-g2, -g3, etc).
Jeff
- Re: Enabling compiler warning flags,
Jeffrey Walton <=