From: Paul Eggert Date: Wed, 21 Sep 2005 19:54:48 +0000 (+0000) Subject: More alloca cleanups. X-Git-Tag: v2.3b~634 X-Git-Url: https://git.saurik.com/bison.git/commitdiff_plain/0d50976f3c7b4e74e8cbe32dbeb0312a7845ca14 More alloca cleanups. * 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 || defined _ALLOCA_H)]: Don't include ; not needed in this case. * tests/torture.at (Exploding the Stack Size with Alloca): Adjust to match yacc.c, to test more hosts. --- diff --git a/ChangeLog b/ChangeLog index 232fede6..c2da9f87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-09-21 Paul Eggert + + * 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 || defined _ALLOCA_H)]: Don't include ; + not needed in this case. + * tests/torture.at (Exploding the Stack Size with Alloca): Adjust + to match yacc.c, to test more hosts. + 2005-09-20 Paul Eggert * data/yacc.c (YYSIZE_T): Reindent to make it clearer. This diff --git a/bootstrap b/bootstrap index 96c9bcb3..017517fc 100755 --- a/bootstrap +++ b/bootstrap @@ -92,7 +92,6 @@ esac <$GNULIB_SRCDIR/gnulib-tool || exit gnulib_modules=' -alloca argmatch dirname error diff --git a/data/yacc.c b/data/yacc.c index 2ba3ceac..9cb7f2f3 100644 --- a/data/yacc.c +++ b/data/yacc.c @@ -263,7 +263,8 @@ b4_syncline([@oline@], [@ofile@])[ # define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined (_STDLIB_H) && (defined (__STDC__) || defined (__cplusplus)) +# if (! defined (alloca) && ! defined (_ALLOCA_H) && ! defined (_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 diff --git a/src/main.c b/src/main.c index 08de7216..65db7ca1 100644 --- a/src/main.c +++ b/src/main.c @@ -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) diff --git a/tests/torture.at b/tests/torture.at index 16425f6a..e0d8087a 100644 --- a/tests/torture.at +++ b/tests/torture.at @@ -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 || defined _ALLOCA_H) # define YYSTACK_USE_ALLOCA 1 #endif ]])