* doc/autoconf.texi (Particular Functions): Don't redeclare alloca on FreeBSD. * THANKS: Update. Reported by Giorgos Keramidas.
Signed-off-by: Eric Blake <ebl...@redhat.com> --- >> #elif !defined(HAVE_ALLOCA) >> # if defined __GNUC__ >> # define alloca __builtin_alloca >> # elif defined _AIX >> # define alloca __alloca >> # else >> # include <stddef.h> >> # ifdef __cplusplus >> extern "C" >> # endif >> extern "C" >> # endif >> void *alloca (size_t); >> # endif >> #endif > Then again, since AC_FUNC_ALLOCA does indeed set HAVE_ALLOCA via > AC_DEFINE, your patch proposal probably makes sense. Actually, your patch is not quite right - to get alloca on FreeBSD, you still have to include the right system headers. The AC_FUNC_ALLOCA macro is already including <stdlib.h> at configure time, by virtue of AC_INCLUDES_DEFAULT, but your C code must do the same. I don't see a problem with the configure test having a redundant redeclaration, without evidence of it causing a false negative test result, but agree that we might as well avoid the redundant declaration in user code. Here's what I will be pushing. ChangeLog | 5 +++++ doc/autoconf.texi | 14 ++++++++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index c874eab..8fa6874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2010-09-08 Eric Blake <ebl...@redhat.com> + docs: update alloca recommendations + * doc/autoconf.texi (Particular Functions): Don't redeclare alloca + on FreeBSD. + Reported by Giorgos Keramidas. + docs: link to GNU Coding Standards in intro * doc/autoconf.texi (Introduction): Actually link to the standards. Make other references consistent. diff --git a/doc/autoconf.texi b/doc/autoconf.texi index 99054c5..780e93a 100644 --- a/doc/autoconf.texi +++ b/doc/autoconf.texi @@ -4816,6 +4816,14 @@ Particular Functions @example @group +#ifdef STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# ifdef HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif #ifdef HAVE_ALLOCA_H # include <alloca.h> #elif defined __GNUC__ @@ -4827,10 +4835,12 @@ Particular Functions # define alloca _alloca #else # include <stddef.h> -# ifdef __cplusplus +# ifndef HAVE_ALLOCA +# ifdef __cplusplus extern "C" -# endif +# endif void *alloca (size_t); +# endif #endif @end group @end example -- 1.7.2.2