]> git.saurik.com Git - bison.git/blobdiff - tests/regression.at
fix previous changelog entry
[bison.git] / tests / regression.at
index 36b95eb102c3e89241243038c8fe22b18b902e5f..761e1bedbfd17e4ae92fd382de5d4bbdf5fee4e1 100644 (file)
@@ -434,6 +434,7 @@ AT_SETUP([Token definitions])
 # Bison managed, when fed with `%token 'f' "f"' to #define 'f'!
 AT_DATA_GRAMMAR([input.y],
 [%{
+#include <stdlib.h>
 #include <stdio.h>
 void yyerror (const char *s);
 int yylex (void);
@@ -457,6 +458,9 @@ yyerror (char const *s)
 int
 yylex (void)
 {
+  static int called;
+  if (called++)
+    abort ();
   return SPECIAL;
 }
 
@@ -822,7 +826,8 @@ m4_define([_AT_DATA_DANCER_Y],
 [%{
 static int yylex (AT_LALR1_CC_IF([int *], [void]));
 AT_LALR1_CC_IF([],
-[#include <stdio.h>
+[#include <stdlib.h>
+#include <stdio.h>
 static void yyerror (const char *);])
 %}
 $1
@@ -881,7 +886,9 @@ int
 yyparse ()
 {
   yy::parser parser;
-  parser.set_debug_level (!!YYDEBUG);
+#if YYDEBUG
+  parser.set_debug_level (YYDEBUG);
+#endif
   return parser.parse ();
 }
 ],
@@ -894,12 +901,14 @@ yyerror (const char *s)
 static int
 yylex (AT_LALR1_CC_IF([int *lval], [void]))
 [{
-  static int toknum = 0;
-  static int tokens[] =
+  static int const tokens[] =
     {
       ':', -1
     };
+  static size_t toknum;
   ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC.  */])[
+  if (! (toknum < sizeof tokens / sizeof *tokens))
+    abort ();
   return tokens[toknum++];
 }]
 
@@ -950,6 +959,7 @@ m4_define([_AT_DATA_EXPECT2_Y],
 static int yylex (AT_LALR1_CC_IF([int *], [void]));
 AT_LALR1_CC_IF([],
 [#include <stdio.h>
+#include <stdlib.h>
 static void yyerror (const char *);])
 %}
 $1
@@ -991,12 +1001,14 @@ yyerror (const char *s)
 static int
 yylex (AT_LALR1_CC_IF([int *lval], [void]))
 [{
-  static int toknum = 0;
-  static int tokens[] =
+  static int const tokens[] =
     {
       1000, '+', '+', -1
     };
+  static size_t toknum;
   ]AT_LALR1_CC_IF([*lval = 0; /* Pacify GCC.  */])[
+  if (! (toknum < sizeof tokens / sizeof *tokens))
+    abort ();
   return tokens[toknum++];
 }]
 
@@ -1094,7 +1106,7 @@ AT_PARSER_CHECK([./input], 0,
 ]],
 [[Starting parse
 Entering state 0
-Reducing stack by rule 1 (line 22):
+Reducing stack by rule 1 (line 20):
 -> $$ = nterm start ()
 Stack now 0
 Entering state 1