[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Turn on compiler warnings by default for AC_PROG_CC, AC_PROG_CXX & A
Re: Turn on compiler warnings by default for AC_PROG_CC, AC_PROG_CXX & AC_PROG_FC
Fri, 17 Jan 2014 17:21:09 -0500
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:24.0) Gecko/20100101 Thunderbird/24.0.1
On 2014-01-17 4:02 PM, David A. Wheeler wrote:
Zack Weinberg said:
For GCC I would be quite hesitant to turn anything on beyond -Wall
without explicit buy-in from the project, but I like the idea of
enabling -Wall by default.
I pretty sure that's what Dale Visser's patch does. It says: +
"-pedantic % -Wall" dnl GCC
Dale Visser's patch does include a comment that says: +# For the
GNU compiler it will be -Wall (and -ansi -pedantic) The result +#
is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by
But I think this comment is no longer true. It appears to me that the
code is just trying to see if "-pedantic" *WORKS*, and if it does,
then using that as evidence that "-Wall" would work.
Oh, is that what "-pedantic % -Wall" means? I had the impression it was
going to try each one in isolation and include the subset that worked.
Despite the dire things the GCC manual says about -pedantic, it is not
hard to write *new* code that is -pedantic clean, or -Wextra clean, etc;
I would support an opt-in mechanism for enabling a much more aggressive
set of warnings, and recommending its use in the manual for new
projects. But any such thing has a high probability of breaking *old*
code, hence my earlier comments. Also, as long as stock Autoconf checks
are sloppy (e.g. AC_CHECK_FUNCS and its habit of blindly declaring
everything as "char foo();") we will need to distinguish warnings
enabled for the *project* from warnings enabled for the *configure script*.
-ansi, however, should not be in there at all; it doesn't just turn on
strict conformance mode, it turns on strict *C89* conformance mode,
which is often wrong for new code. And even nowadays, strict
conformance mode in general tends to break system headers.