[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
removing alloca from Bison itself
From: |
Paul Eggert |
Subject: |
removing alloca from Bison itself |
Date: |
Wed, 21 Sep 2005 13:12:26 -0700 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
The recent alloca changes prompted me to look again at the use of
alloca within Bison. I found a couple of places where the alloca gorp
can be removed, so I did that. I also found one place where the
yacc.c skeleton is including <stdlib.h> when it's not needed, and one
place where alloca's tests should match its uses better. I installed
the following change.
This change effectively removes three files from the Bison tarball:
lib/alloca.c, lib/alloca_.h, and m4/alloca.m4.
2005-09-21 Paul Eggert <address@hidden>
* bootstrap (gnulib_modules): Remove alloca. Bison doesn't need
it itself.
* src/main.c (main) [C_ALLOCA]: Don't flush alloca'ed memory; we
don't use alloca any more.
* data/yacc.c [YYSTACK_USE_ALLOCA && !defined __GNUC__ && ! defined
__BUILTIN_VA_ARG_INCR && ! defined _AIX && ! defined _MSC_VER &&
defined _ALLOCA_H]: Don't include <stdlib.h>; not needed in this case.
* tests/torture.at (Exploding the Stack Size with Alloca): Adjust
to match yacc.c, to test more hosts.
Index: bootstrap
===================================================================
RCS file: /cvsroot/bison/bison/bootstrap,v
retrieving revision 1.26
retrieving revision 1.27
diff -p -u -r1.26 -r1.27
--- bootstrap 8 Sep 2005 18:26:43 -0000 1.26
+++ bootstrap 21 Sep 2005 19:54:48 -0000 1.27
@@ -92,7 +92,6 @@ esac
<$GNULIB_SRCDIR/gnulib-tool || exit
gnulib_modules='
-alloca
argmatch
dirname
error
Index: src/main.c
===================================================================
RCS file: /cvsroot/bison/bison/src/main.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -p -u -r1.83 -r1.84
--- src/main.c 25 Jul 2005 03:12:53 -0000 1.83
+++ src/main.c 21 Sep 2005 19:54:48 -0000 1.84
@@ -172,14 +172,6 @@ main (int argc, char *argv[])
scanner_free ();
muscle_free ();
uniqstrs_free ();
- /* If using alloca.c, flush the alloca'ed memory for the benefit of
- people running Bison as a library in IDEs. */
-#if C_ALLOCA
- {
- extern void *alloca (size_t);
- alloca (0);
- }
-#endif
timevar_pop (TV_FREE);
if (trace_flag & trace_bitsets)
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.107
retrieving revision 1.109
diff -p -u -r1.107 -r1.109
--- data/yacc.c 20 Sep 2005 23:08:03 -0000 1.107
+++ data/yacc.c 21 Sep 2005 20:08:38 -0000 1.109
@@ -263,7 +263,8 @@ b4_syncline(address@hidden@], address@hidden@])[
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined (_STDLIB_H) && (defined (__STDC__) || defined (__cplusplus))
+# if (! defined (_ALLOCA_H) && ! defined (_STDLIB_H) \
+ && (defined (__STDC__) || defined (__cplusplus)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
# ifndef _STDLIB_H
# define _STDLIB_H 1
Index: tests/torture.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/torture.at,v
retrieving revision 1.28
retrieving revision 1.30
diff -p -u -r1.28 -r1.30
--- tests/torture.at 24 Jul 2005 07:24:22 -0000 1.28
+++ tests/torture.at 21 Sep 2005 20:08:38 -0000 1.30
@@ -444,7 +444,8 @@ AT_COMPILE([input])
AT_SETUP([Exploding the Stack Size with Alloca])
AT_DATA_STACK_TORTURE([[
-#if defined __GNUC__ || defined alloca
+#if (defined __GNUC__ || defined __BUILTIN_VA_ARG_INCR \
+ || defined _AIX || defined _MSC_VER || defined _ALLOCA_H)
# define YYSTACK_USE_ALLOCA 1
#endif
]])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- removing alloca from Bison itself,
Paul Eggert <=