Re: Testing for unknown flags in different compilers

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

 



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

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf

[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux