[Top][All Lists]

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

Re: uses old-style function definition, thus fails with -Werror=old-styl

From: Eric Blake
Subject: Re: uses old-style function definition, thus fails with -Werror=old-style-definition
Date: Fri, 03 Jan 2014 15:10:57 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0

On 01/03/2014 02:56 PM, Eric Blake wrote:
> On 01/03/2014 02:51 PM, Vincent Lefevre wrote:
>> A developer may want to test his software with
>> -Werror=old-style-definition (in particular because such definitions
>> could be a real bug in the software). But configure fails because
>> autoconf (version 2.69) generates such a function definition.
> Read the list archives.  We have repeatedly said that anyone running
> ./configure CFLAGS=-Werror is asking for problems, because we CANNOT
> guarantee warning-free compilation across all versions of all compilers.
>  The only SANE way to use -Werror in configure is to probe whether it
> exists, and then add it to a secondary make variable that you then
> append to your source files (where it does make sense), while still
> leaving CFLAGS untainted so that configure doesn't trip over (sometimes
> intentional) warnings.
> The bug is not in autoconf, but in your programs for polluting CFLAGS.
> That said, if someone has the time and inclination to write a patch that
> would make autoconf automatically strip out -Werror* arguments from
> CFLAGS for the duration of the configure testing, then add it back in at
> the end, be my guest.

Also, for your PARTICULAR case of wanting to use main(void) instead of
main() throughoug would make sense, particularly since we continue to
move away from K&R C support, can pretty much assume a minimum C89
support on all viable modern porting targets, and have even toggled the
default to preferring C11 or C99 over C89 when probing for a C compiler
of unspecified version.  Furthermore, at least AC_PROG_LEX already uses
main(void), and no one has complained of that test tripping up a wrong
configure test because of a compiler that could not parse it.  So a
simpler patch that fixes all of autoconf to use main(void) instead of
main() is fair game for immediate inclusion.  Do you have time to write
such a patch, instead of waiting on me?

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]