From 8df1cde7814e04abc0e36c0d05f4c74fa05b96f4 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 19 Dec 2004 13:41:34 +0000 Subject: [PATCH] * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H. Remove now-obsolete comment about AIX. * getdate.y: Include only if HAVE_ALLOCA. (YYSTACK_USE_ALLOCA): Define to 0 if !HAVE_ALLOCA. (YYMAXDEPTH): New macro. --- lib/ChangeLog | 8 ++++++++ lib/alloca_.h | 12 +++++------- lib/getdate.y | 13 ++++++++++++- 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 6601ce55d2..762e3ebd42 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,11 @@ +2004-12-19 Paul Eggert + + * alloca_.h: Conditionalize on _GNULIB_ALLOCA_H, not _ALLOCA_H. + Remove now-obsolete comment about AIX. + * getdate.y: Include only if HAVE_ALLOCA. + (YYSTACK_USE_ALLOCA): Define to 0 if !HAVE_ALLOCA. + (YYMAXDEPTH): New macro. + 2004-12-18 Bruno Haible * fatal-signal.c (fatal_signals): Make non-const. diff --git a/lib/alloca_.h b/lib/alloca_.h index 10995510e2..799037ce09 100644 --- a/lib/alloca_.h +++ b/lib/alloca_.h @@ -18,12 +18,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* When this file is included, it may be preceded only by preprocessor - declarations. Thanks to AIX. Therefore we include it right after - "config.h", not later. */ - -#ifndef _ALLOCA_H -# define _ALLOCA_H +/* Avoid using the symbol _ALLOCA_H here, as Bison assumes _ALLOCA_H + means there is a real alloca function. */ +#ifndef _GNULIB_ALLOCA_H +# define _GNULIB_ALLOCA_H /* alloca (N) returns a pointer to N bytes of memory allocated on the stack, which will last until the function returns. @@ -51,4 +49,4 @@ extern "C" void *alloca (size_t); #endif -#endif /* _ALLOCA_H */ +#endif /* _GNULIB_ALLOCA_H */ diff --git a/lib/getdate.y b/lib/getdate.y index 6ffee30b96..b57e6a56d3 100644 --- a/lib/getdate.y +++ b/lib/getdate.y @@ -36,7 +36,18 @@ #include "getdate.h" -#include +/* Use alloca only if it is known to be builtin. */ +#if HAVE_ALLOCA +# include +#else +# define YYSTACK_USE_ALLOCA 0 +#endif + +/* Tell Bison ow much stack space is needed. 20 should be plenty for + this grammar, which is not right recursive. Beware setting it too + high, since that might cause problems on machines whose alloca + implementations have lame stack-overflow checking. */ +#define YYMAXDEPTH 20 /* Since the code of getdate.y is not included in the Emacs executable itself, there is no need to #define static in this file. Even if -- 2.30.2