]> git.saurik.com Git - bison.git/blobdiff - tests/torture.at
* src/scan-skel.l: Output the base name parts of the parser and
[bison.git] / tests / torture.at
index af5019bc9ae901bd452312bbe46cb11463058430..b35052fc450d498d6920d852c21ddaa0deca6785 100644 (file)
@@ -388,6 +388,8 @@ m4_define([AT_DATA_STACK_TORTURE],
 # exp:
 AT_DATA([input.y],
 [[%{
+#include <errno.h>
+#include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
 ]$1[
@@ -406,9 +408,6 @@ yyerror (const char *msg)
   fprintf (stderr, "%s\n", msg);
 }
 
-/* There are YYLVAL_MAX of WAIT_FOR_EOFs. */
-unsigned int yylval_max;
-
 static int
 yylex (void)
 {
@@ -421,9 +420,14 @@ yylex (void)
 int
 main (int argc, const char **argv)
 {
+  char *endp;
   if (argc != 2)
     abort ();
-  yylval = atoi (argv[1]);
+  yylval = strtol (argv[1], &endp, 10);
+  if (! (argv[1] != endp
+        && 0 <= yylval && yylval <= INT_MAX
+        && errno != ERANGE))
+    abort ();
   yydebug = 1;
   return yyparse ();
 }
@@ -440,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
 ]])