bison-patches
[Top][All Lists]
Advanced

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

bison/data/glr.c warning removal


From: Paul Eggert
Subject: bison/data/glr.c warning removal
Date: Tue, 29 Oct 2002 21:41:37 -0800 (PST)

A "make check" with GCC 3.2 and "configure --enable-gcc-warnings" on
Solaris 8 found yet another reason to warn about YYLEFTMOST_STATE in
glr.c due to missing initializers.  I got tired of worrying about this
issue and installed the following patch to remove YYLEFTMOST_STATE
entirely.  As a minor side benefit the executable is smaller and maybe
even faster.

2002-10-29  Paul Eggert  <address@hidden>

        * data/glr.c (YYLEFTMOST_STATE): Remove.
        (yyreportTree): Use a stack-based leftmost state.  This avoids
        our continuing battles with bogus warnings about initializers.

Index: glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -p -u -r1.25 -r1.26
--- glr.c       24 Oct 2002 11:40:27 -0000      1.25
+++ glr.c       30 Oct 2002 05:38:30 -0000      1.26
@@ -1284,17 +1284,6 @@ yyresolveAction (yySemanticOption* yyopt
 }
 
 #if YYDEBUG
-static yyGLRState YYLEFTMOST_STATE =
-  {
-    0, 0, -1, NULL, 0, { NULL },
-    /* yyloc.  */
-    {
-#if YYLTYPE_IS_TRIVIAL
-]b4_location_if([      0, 0, 0, 0])[
-#endif
-    }
-  };
-
 static void
 yyreportTree (yySemanticOption* yyx, int yyindent)
 {
@@ -1302,11 +1291,15 @@ yyreportTree (yySemanticOption* yyx, int
   int yyi;
   yyGLRState* yys;
   yyGLRState* yystates[YYMAXRHS];
+  yyGLRState yyleftmost_state;
 
   for (yyi = yynrhs, yys = yyx->yystate; 0 < yyi; yyi -= 1, yys = yys->yypred)
     yystates[yyi] = yys;
   if (yys == NULL)
-    yystates[0] = &YYLEFTMOST_STATE;
+    {
+      yyleftmost_state.yyposn = 0;
+      yystates[0] = &yyleftmost_state;
+    }
   else
     yystates[0] = yys;
 




reply via email to

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