bug-gnulib
[Top][All Lists]
Advanced

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

Re: AC_FUNC_ALLOCA shouldn't define prototype


From: Eric Blake
Subject: Re: AC_FUNC_ALLOCA shouldn't define prototype
Date: Wed, 04 Aug 2010 16:03:56 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Lightning/1.0b2pre Mnenhy/0.8.3 Thunderbird/3.1.1

[adding bug-gnulib, as another interested party in alloca replacements]

On 08/04/2010 03:59 PM, Thomas Klausner wrote:
> Hi!
> 
> Joerg Sonnenberger recently committed the attached patch to pkgsrc
> (for autoconf-2.66) prohibiting AC_FUNC_ALLOCA from defining a
> prototype on the BSDs.
> 
> The reason was:
> Do not fall through to the implicit prototype as it conflicts with
> stdlib.h.
> 
> Please include (something like) this in the next autoconf release.
> 
> Thanks,
>  Thomas


> Do not fall through to the implicit prototype as it conflicts with
> stdlib.h.
> 
> --- lib/autoconf/functions.m4.orig    2010-07-29 15:21:52.000000000 +0000
> +++ lib/autoconf/functions.m4
> @@ -369,6 +369,8 @@ AC_CACHE_CHECK([for alloca], ac_cv_func_
>  # ifdef _MSC_VER
>  #  include <malloc.h>
>  #  define alloca _alloca
> +# elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) 
> || defined(__OpenBSD__)
> +#   include <stdlib.h>
>  # else
>  #  ifdef HAVE_ALLOCA_H
>  #   include <alloca.h>

Rather than hard-code the check based on platform-specific defines, it
would be more in the autoconf spirit to instead write a probe whether
<stdlib.h> declares alloca(), and if so, define a witness macro.  That
way, we would be more robust to other <stdlib.h> implementations adding
a declaration.

-- 
Eric Blake   address@hidden    +1-801-349-2682
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]