autoconf-patches
[Top][All Lists]
Advanced

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

Re: alloca patch


From: Eric Blake
Subject: Re: alloca patch
Date: Thu, 20 Dec 2012 08:31:43 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0

On 12/20/2012 02:51 AM, Patrick Welche wrote:
> Having seen the message that a release might be imminent, I had a look
> at the patches for autoconf in
> http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/devel/autoconf/patches
> 
> so the attached might want to go in...
> 

> +++ b/lib/autoconf/functions.m4
> @@ -384,6 +384,8 @@ AC_CACHE_CHECK([for alloca], ac_cv_func_alloca_works,
>  # ifdef _MSC_VER
>  #  include <malloc.h>
>  #  define alloca _alloca
> +# elif defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) 
> || defined(__OpenBSD__)
> +#  include <stdlib.h>

Does it harm things to unconditionally include <stdlib.h> even on
non-BSD platforms?   If not, that would be a simpler solution.
Furthermore, I'm reluctant to patch this without also patching the
documentation to match, where we currently suggest:

#if defined STDC_HEADERS || defined HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <stddef.h>
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif !defined alloca
# ifdef __GNUC__
#  define alloca __builtin_alloca
# elif defined _AIX
#  define alloca __alloca
# elif defined _MSC_VER
#  include <malloc.h>
#  define alloca _alloca
# elif !defined HAVE_ALLOCA
#  ifdef  __cplusplus
extern "C"
#  endif
void *alloca (size_t);
# endif
#endif

Or maybe the problem is that our test for ac_cv_func_alloca_works
doesn't match the documentation, since it is only doing:

#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# ifdef _MSC_VER
#  include <malloc.h>
#  define alloca _alloca
# else
#  ifdef HAVE_ALLOCA_H
#   include <alloca.h>
#  else
#   ifdef _AIX
 #pragma alloca
#   else
#    ifndef alloca /* predefined by HP cc +Olibcalls */
void *alloca (size_t);
#    endif
#   endif
#  endif
# endif
#endif

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
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]