bug-autoconf
[Top][All Lists]
Advanced

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

Recommended alloca declaration breaks on alloca.c


From: Hrvoje Niksic
Subject: Recommended alloca declaration breaks on alloca.c
Date: Sun, 10 Apr 2005 14:02:20 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

I tried to compile Wget with "tcc", a tiny fast Linux compiler that
happens to not implement alloca.  Since Wget's configure checks for
alloca and the source includes the C alloca implementation, it should
(in theory) work anyway.  However, I got a compiler error:

tcc -I. -I.    -DHAVE_CONFIG_H -DSYSTEM_WGETRC=\"/usr/local/etc/wgetrc\" 
-DLOCALEDIR=\"/usr/local/share/locale\" -O -c alloca.c
In file included from alloca.c:32:
In file included from /usr/include/stdlib.h:578:
/usr/include/alloca.h:33: incompatible types for redefinition of 'alloca'
make: *** [alloca.o] Error 1

It turns out that the alloca declaration that the Autoconf manual[1]
recommends for config.h declares alloca() as returning char *, whereas
the C implementation I use declares it as returning void *.  But
regardless of alloca.c, another problem is that, on Linux, stdlib.h
includes alloca.h, which also declares void *alloca().

I fixed this problem by changing the declaration from "char
*alloca();" to "void *alloca();".  Is there a better fix, or should
the manual be updated for alloca to return void *?


[1]
The section of the manual I'm referring to is:

    
http://www.gnu.org/software/autoconf/manual/autoconf-2.57/html_chapter/autoconf_5.html#SEC46




reply via email to

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