Subject: commandline-specified CFLAGS override -std= parameter from AC_PROG_CC_C99
Date: Wed, 09 Jul 2014 09:50:08 +0200
Package: autoconf
Version: 2.69-7
Severity: normal
Hi,
The nbd configure.ac contains:
AC_PROG_CC_C99
because I use a number of C99 constructs in the code. When, however, I
run configure like so:
./configure CFLAGS='-g -O0 -Wall -Werror'
because I want to clean up the code a bit, I get an error message at
compile time:
nbdsrv.c: In function 'getmaskbyte':
nbdsrv.c:116:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
for(int i = 7; i + masklen > 7; i--) {
^
which is surprising, since I asked for C99 mode. If I specify CFLAGS so
it also contains '-std=gnu99', then everything compiles cleanly (apart
from the bits that are caused by the -Wall -Werror, that is).
-- System Information:
Debian Release: jessie/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 3.14-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=nl_BE.UTF-8, LC_CTYPE=nl_BE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages autoconf depends on:
ii debianutils 4.4
ii m4 1.4.17-4
ii perl 5.18.2-5
Versions of packages autoconf recommends:
ii automake [automaken] 1:1.14.1-3
ii automake1.11 [automaken] 1:1.11.6-2
Versions of packages autoconf suggests:
pn autoconf-archive <none>
ii autoconf-doc 2.69-7
ii gettext 0.18.3.2-3
ii gnu-standards 2010.03.11-1
ii libtool 2.4.2-1.7
-- no debconf information
Subject: Re: Bug#754268: commandline-specified CFLAGS override -std=
parameter from AC_PROG_CC_C99
Date: Sat, 9 Aug 2014 08:29:51 -0700
[resending due to wrong @bugs address in last copy, sorry]
On Wed, Jul 09, 2014 at 09:50:08AM +0200, Wouter Verhelst wrote:
> Package: autoconf
> Version: 2.69-7
> Severity: normal
>
> Hi,
>
> The nbd configure.ac contains:
>
> AC_PROG_CC_C99
>
> because I use a number of C99 constructs in the code. When, however, I
> run configure like so:
>
> ./configure CFLAGS='-g -O0 -Wall -Werror'
>
> because I want to clean up the code a bit, I get an error message at
> compile time:
>
> nbdsrv.c: In function 'getmaskbyte':
> nbdsrv.c:116:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
> for(int i = 7; i + masklen > 7; i--) {
> ^
>
> which is surprising, since I asked for C99 mode. If I specify CFLAGS so
> it also contains '-std=gnu99', then everything compiles cleanly (apart
> from the bits that are caused by the -Wall -Werror, that is).
Specifying -Werror in CFLAGS to configure is almost always a mistake.
It screws up Autoconf tests, because some Autoconf tests unavoidably
provoke warnings. Remove -Werror and you'll get better results.
Debbugs is free software and licensed under the terms of the GNU General
Public License version 2. The current version can be obtained
from https://bugs.debian.org/debbugs-source/.