bug-autoconf
[Top][All Lists]
Advanced

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

Re: More problems on HP-UX ... 4


From: Andreas Vögele
Subject: Re: More problems on HP-UX ... 4
Date: Sun, 9 May 2004 18:34:57 +0200

Kevin Ryde writes:

Andreas Vögele <address@hidden> writes:

Here's the patch that I use.

Hmm. I don't really want to make that change. What's there now is what autoconf recommends, and I'd rather see it changed in autoconf first.

That's if a change is needed, since what you report contradicts what the gcc manual says about alloca being a builtin.

alloca() may be built in but recent versions of GCC require a function declaration. For example, GCC 2.95 compiles the following code without printing a warning since strlen() is built in. On the other hand, GCC 3.3 will output a warning if the compiler option -Wall is used and <string.h> is not included.

int main(void)
{
  return strlen ("hello, world");
}

The same applies to alloca(). The code recommendation for alloca() in the section "Particular Function Checks" of the Autoconf manual isn't up-to-date. If __GNUC__ is defined the code does not make sure that alloca() is declared.

The easiest solution is to change the recommended code so that __builtin_alloca() is used if __GNUC_ is defined. If the '__builtin_' function is used no declaration is required. You can verify this by replacing strlen() with __builtin_strlen() in the above example.

#ifdef __GNUC__
# define alloca(x) __builtin_alloca(x)
#else
# if HAVE_ALLOCA_H
... /* remaining code from the Autoconf manual */
# endif
#endif

BTW, building Guile with GCC 3.3 does not fail on glibc-based systems since stdlib.h includes alloca.h. But there are systems where alloca.h is not included by stdlib.h.

As far as I can see, eval.c is the only place in Guile where alloca() is used. Wouldn't it be possible to get rid of alloca()? According to the comp.lang.c FAQ the use of alloca() is discouraged anyway (http://www.eskimo.com/~scs/C-faq/q7.32.html).





reply via email to

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