[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] Re: getdate don't need alloca
From: |
Paul Eggert |
Subject: |
Re: [bug-gnulib] Re: getdate don't need alloca |
Date: |
Fri, 17 Dec 2004 23:53:25 -0800 |
User-agent: |
Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) |
Simon Josefsson <address@hidden> writes:
> Wouldn't it would work if the user didn't put $(ALLOCA) in LIBADD?
Yes, I suppose it might.
> The Bison-generate code don't include alloca.h, getdate.y did.
Right.
Simon Josefsson <address@hidden> writes:
> 3) wrap the '#include <alloca.h>' inside a HAVE_ALLOCA test, in
> getdate.y. Then if I'm not mistaken, getdate.y will work in all
> situations I can think of: no alloca stuff whatsoever, with
> alloca-opt, and with alloca.
This seems like a good approach to me. It is a bit of a special case,
because of the bison-generated code. Can you give it a try?
(Or did you already try it? Sorry, I lost track of the patch.)
> It is not clear to me if the bison-generated code only ever allocate
> small strings -- to me it seems it can grow the alloca buffer large.
The alloca buffer size is limited by YYMAXDEPTH. Admittedly this
limit is too large, and can cause problems in practice on some modern
hosts that are close to the stack limit.
Perhaps someting like the following patch would do the trick?
--- getdate.y.~1.91.~ 2004-12-08 14:01:51 -0800
+++ getdate.y 2004-12-17 23:42:11 -0800
@@ -36,7 +36,13 @@
#include "getdate.h"
-#include <alloca.h>
+#if HAVE_ALLOCA
+# include <alloca.h>
+# define YYMAXDEPTH \
+ ((4032 - sizeof (YYSTYPE)) / (sizeof (short) + sizeof (YYSTYPE)))
+#else
+# define YYSTACK_USE_ALLOCA 0
+#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
?
- [bug-gnulib] getdate don't need alloca, Simon Josefsson, 2004/12/17
- Re: [bug-gnulib] getdate don't need alloca, Bruno Haible, 2004/12/17
- [bug-gnulib] Re: getdate don't need alloca, Simon Josefsson, 2004/12/17
- [bug-gnulib] Re: getdate don't need alloca, Bruno Haible, 2004/12/17
- [bug-gnulib] Re: getdate don't need alloca, Simon Josefsson, 2004/12/17
- Re: [bug-gnulib] Re: getdate don't need alloca, Paul Eggert, 2004/12/17
- [bug-gnulib] Re: getdate don't need alloca, Simon Josefsson, 2004/12/17
- Re: [bug-gnulib] Re: getdate don't need alloca,
Paul Eggert <=
- [bug-gnulib] Re: getdate don't need alloca, Bruno Haible, 2004/12/18
- [bug-gnulib] Re: getdate don't need alloca, Simon Josefsson, 2004/12/18
- Re: [bug-gnulib] Re: getdate don't need alloca, Paul Eggert, 2004/12/19
- [bug-gnulib] Re: getdate don't need alloca, Simon Josefsson, 2004/12/19
- Re: [bug-gnulib] Re: getdate don't need alloca, Bruno Haible, 2004/12/21
- Re: [bug-gnulib] Re: getdate don't need alloca, Paul Eggert, 2004/12/22
[bug-gnulib] Re: getdate don't need alloca, Simon Josefsson, 2004/12/17