bug-autoconf
[Top][All Lists]
Advanced

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

Re: AC_FUNC_ALLOCA generates warning (problem with -Werror)


From: Jaap Haitsma
Subject: Re: AC_FUNC_ALLOCA generates warning (problem with -Werror)
Date: Tue, 06 Jun 2006 22:39:17 +0200

On Mon, 2006-06-05 at 19:01 -0700, Paul Eggert wrote:
> Jaap Haitsma <address@hidden> writes:
> 
> > This generates a warning that the variable p is never used. This is a
> > problem when you run configure with CFLAG="-Werror". Compilation of the
> > above code will fail.
> 
> Can you please give more details?  I can't reproduce the problem.

Sorry I should have told you to also enable -Wall.

./configure CFLAGS='-Werror -Wall'

checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for working alloca.h... no
checking for alloca... no
checking whether `alloca.c' needs Cray hooks... no
checking stack direction for C alloca... -1
configure: creating ./config.status

You see then it says that alloca is not on my system. If I leave the
-Wall out I get the same output as you.

Basically the macros should not contain unused variables otherwise
macros with CFLAGS="-Wall -Werror" will lead to erroneous results.

I also noticed an error in my solution.

It should be
for (;&p==0;) {/*Use p so we do not generate a warning */}
instead of
for (;&p!=0;) {/*Use p so we do not generate a warning */}
of course


Jaap


> Here's how I tried:
> 
> $ cat configure.ac
> AC_INIT
> AC_FUNC_ALLOCA
> AC_OUTPUT
> $ autoconf
> $ ./configure CFLAGS='-Werror'
> checking for gcc... gcc
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... yes
> checking whether we are cross compiling... no
> checking for suffix of executables... 
> checking for suffix of object files... o
> checking whether we are using the GNU C compiler... yes
> checking whether gcc accepts -g... yes
> checking for gcc option to accept ANSI C... none needed
> checking how to run the C preprocessor... gcc -E
> checking for egrep... grep -E
> checking for working alloca.h... yes
> checking for alloca... yes
> configure: creating ./config.status
> $ gcc --version | sed 1q
> gcc (GCC) 4.1.1
> $ uname -a
> Linux penguin 2.4.27-3-686 #1 Wed Feb 8 12:40:33 UTC 2006 i686 GNU/Linux
> $ autoconf --version | sed 1q
> autoconf (GNU Autoconf) 2.59





reply via email to

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