autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Testing for unknown flags in different compilers


From: Eric Blake
Subject: Re: Testing for unknown flags in different compilers
Date: Fri, 21 Feb 2014 15:16:18 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 02/21/2014 03:01 PM, Carsten Heinrici wrote:
> Hi Julie
> 
> 
> 
>>>> I have been working on a changes whereby an autoconf
>>>> user can invoke a macro like
>>>>
>>>> AC_WARN_ADD([-Wextra])
> 
> The point is the portability. Your flags (-Wextra) depend on the actual 
> compiler. This js against the philosophy behind autoconf, which tries to 
> abstract from it.

No, this is totally in line with autoconf philosophy - the point is to
call AC_WARN_ADD for a large set of flags that have been shown to work
in at least one compiler, and then for each flag in that set, only
enable the flags that the current compiler actually honors (or at least
silently ignores).  The proposal is not to blindly add the gcc-specific
-Wextra flag to all $CC runs, but rather to test if $CC supports
-Wextra, and if so, THEN add -Wextra to a variable (we probably also
want the user to be able to control whether it is added directly to
CFLAGS or to some other variable, the way the gnulib module
'manywarnings' already does).

> 
> If wanted, a developper always can add additional specific compiler flags 
> during runtime by specifying them via CFLAGS on command line.

This will still remain true.  And the developer's choice of CFLAGS
should always take precedence over any default flags that autoconf
probes for in the absence of a developer preference.

> 
> What would be required is a general macro AC_EXTRA_WARNINGS without arguments 
> which could resolve to the actually current arguments of the tool.

Yes, AC_EXTRA_WARNINGS (or whatever spelling gets agreed on) would be
the wrapper that has a huge list of known warning flags that various
compilers honor, and calls AC_WARN_ADD on each of them, so that for your
given $CC, you have then set a variable with the subset of warning flags
that made sense for your compiler.

-- 
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]