]> git.saurik.com Git - bison.git/commitdiff
* data/glr.c (YYCHK1): Do not assume YYE is in range.
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 9 Sep 2005 22:59:46 +0000 (22:59 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 9 Sep 2005 22:59:46 +0000 (22:59 +0000)
This avoids a diagnostic from gcc -Wswitch-enum.
Problem reported by twlevo@xs4all.nl.

ChangeLog
data/glr.c

index 2acf26447eaa4e8f2004708f23c89828b38c730a..4c71b0a8abceb3195962cae4cb662938038b222d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2005-09-09  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * data/glr.c (YYCHK1): Do not assume YYE is in range.
+       This avoids a diagnostic from gcc -Wswitch-enum.
+       Problem reported by twlevo@xs4all.nl.
+
        * doc/bison.texinfo: Don't use "filename", as per GNU coding
        standards.  Use "file name" or "file" or "name", depending on
        the context.
index 6faa86d3ef65232e4c830a4daa6d4844dadc5a6d..37e05af7fa6975cccef60c07f994638e2641734e 100644 (file)
@@ -2024,7 +2024,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
 #define YYCHK1(YYE)                                                         \
   do {                                                                      \
     switch (YYE) {                                                          \
-    default:                                                                \
+    case yyok:                                                              \
       break;                                                                \
     case yyabort:                                                           \
       goto yyabortlab;                                                      \
@@ -2032,6 +2032,8 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
       goto yyacceptlab;                                                             \
     case yyerr:                                                                     \
       goto yyuser_error;                                                    \
+    default:                                                                \
+      goto yybuglab;                                                        \
     }                                                                       \
   } while (0)
 
@@ -2187,6 +2189,10 @@ b4_syncline([@oline@], [@ofile@])])dnl
   yyresult = 0;
   goto yyreturn;
 
+ yybuglab:
+  YYASSERT (yyfalse);
+  /* Fall through.  */
+
  yyabortlab:
   yyresult = 1;
   goto yyreturn;