[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   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to