autoconf-patches
[Top][All Lists]
Advanced

[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


From: Eric Blake
Subject: Re: Turn on compiler warnings by default for AC_PROG_CC, AC_PROG_CXX & AC_PROG_FC
Date: Mon, 10 Feb 2014 16:00:11 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 02/10/2014 03:28 PM, David A. Wheeler wrote:

>  checking if -Wno-such-option can be added to CFLAGS... yes
> ...
> 
> That looks perfect, it's certainly clear what's going on.

> 
> I'm a little annoyed by the second warning, though, the one that says:
>   cc1: warning: unrecognized command line option "-Wno-such-option" [enabled 
> by default]
> I presume this happens because there's no error return
> given an unrecognized command line option.  That's not a *killer*, but
> that would be annoying since it'd repeat in every compile.

Ah, but it IS a killer to anyone compiling with -Werror.

But gnulib's warnings module has already solved that issue - it is
possible to force gcc into not accepting a -Wno-such-option command line
argument.

You really want to borrow some of the ideas from here:
http://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob_plain;f=m4/warnings.m4

gl_COMPILER_OPTION_IF sounds like your proposed AC_APPEND_FLAG_IFVALID,
with the added benefit of converting -Wno- into -W when probing (gcc
rejects the positive form, and is only silent about the -Wno- form when
no other warnings occur, so you must force gcc into confessing unknown
warnings by using the positive form).

Furthermore, that file also has gl_UNKNOWN_WARNINGS_ARE_ERRORS, which
has various ways of making clang confess which warnings it understands
(clang and gcc have different opinions on what to do with unknown
warnings, and when probing for what warnings you can safely add to
CFLAGS, you REALLY want the probe to reject unknown warnings).

Overall, I think migrating the core functionality of gnulib's warnings
module into autoconf does sound useful, so I'm pleased that you are
pursuing this, and I will answer your off-list query about copyright
assignment.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]