bug-gnulib
[Top][All Lists]
Advanced

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

Re: [bug-gnulib] Re: getdate don't need alloca


From: Bruno Haible
Subject: Re: [bug-gnulib] Re: getdate don't need alloca
Date: Sat, 18 Dec 2004 16:38:04 +0100
User-agent: KMail/1.5

Simon Josefsson wrote:
> Bruno Haible <address@hidden> writes:
> > Look at the .c file that is generated by bison (ca. version 1.30).
>
> FYI, getdate.y doesn't work with bison <= 1.35.

OK, then let's look at the output of a recent bison version, say 1.875e.

# ifdef YYSTACK_USE_ALLOCA
#  if YYSTACK_USE_ALLOCA
#   define YYSTACK_ALLOC alloca
#  endif
# else
#  if defined (alloca) || defined (_ALLOCA_H)
#   define YYSTACK_ALLOC alloca
#  else
#   ifdef __GNUC__
#    define YYSTACK_ALLOC __builtin_alloca
#   endif
#  endif
# endif

This means, if <alloca.h> exists as a header file, the bison generated code
expects it to be #included by the .y file.

It also means, if alloca is not defined as a macro but rather as a compiler
built-in, or as a library function without an <alloca.h> file, the bison
generated code expects YYSTACK_USE_ALLOCA to be defined to 1 by the .y file.

So I would suggest this patch:

*** getdate.y   8 Dec 2004 22:25:43 -0000       1.91
--- getdate.y   18 Dec 2004 15:38:51 -0000
***************
*** 37,42 ****
--- 37,46 ----
  #include "getdate.h"
  
  #include <alloca.h>
+ /* Tell the bison-generated code when alloca() should be used.  */
+ #if HAVE_ALLOCA
+ # define YYSTACK_USE_ALLOCA 1
+ #endif
  
  /* 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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]