bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: data/glr.c YYCHK1 macro value `yyok' in switch


From: Paul Eggert
Subject: Re: data/glr.c YYCHK1 macro value `yyok' in switch
Date: Fri, 09 Sep 2005 16:01:10 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

address@hidden writes:

> gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../src/include -Wswitch-enum
> -Wall -g -O2 -c vv_parser.tab.c  -fPIC -DPIC -o .libs/vv_parser.tab.o
> vv_parser.tab.c: In function `vv_parse':
> vv_parser.tab.c:5936: warning: enumeration value `yyok' not handled in switch

Thanks for reporting this.  I installed this patch.

2005-09-09  Paul Eggert  <address@hidden>

        * data/glr.c (YYCHK1): Do not assume YYE is in range.
        This avoids a diagnostic from gcc -Wswitch-enum.
        Problem reported by address@hidden

--- data/glr.c  9 Sep 2005 22:42:15 -0000       1.118
+++ data/glr.c  9 Sep 2005 22:59:46 -0000       1.119
@@ -2024,7 +2024,7 @@ yyrecoverSyntaxError (yyGLRStack* yystac
 #define YYCHK1(YYE)                                                         \
   do {                                                                      \
     switch (YYE) {                                                          \
-    default:                                                                \
+    case yyok:                                                              \
       break;                                                                \
     case yyabort:                                                           \
       goto yyabortlab;                                                      \
@@ -2032,6 +2032,8 @@ yyrecoverSyntaxError (yyGLRStack* yystac
       goto yyacceptlab;                                                        
     \
     case yyerr:                                                                
     \
       goto yyuser_error;                                                    \
+    default:                                                                \
+      goto yybuglab;                                                        \
     }                                                                       \
   } while (0)
 
@@ -2186,6 +2188,10 @@ b4_syncline(address@hidden@], address@hidden@])])dnl
  yyacceptlab:
   yyresult = 0;
   goto yyreturn;
+
+ yybuglab:
+  YYASSERT (yyfalse);
+  /* Fall through.  */
 
  yyabortlab:
   yyresult = 1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]