bison-patches
[Top][All Lists]
Advanced

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

lint removal in glr.c, calc.at


From: Paul Eggert
Subject: lint removal in glr.c, calc.at
Date: Sun, 17 Nov 2002 23:56:45 -0800 (PST)

I installed the following minor changes while looking into the glr.c
bug with Sun ONE Studio 7 cc.

2002-11-17  Paul Eggert  <address@hidden>

        Pacify Sun ONE Studio 7 lint.  Also, rename "ParseError"
        to "SyntaxError" for consistency with my 2002-11-15 change.

        * data/glr.c (YYDPRINTF, YYDSYMPRINT, YYDSYMPRINTF) [!YYDEBUG]: Do
        not define to {}, since this breaks the common use of `YYDPRINTF
        ((...));' if a single statement is desired (e.g. before `else').
        Work around GCC warnings by surrounding corresponding calls with
        {} if needed.
        (yyhasResolvedValue): Remove unused function.
        (yymergeOptionSets, yyresolvStack): Use `continue;' for empty
        loop body.
        (yyreportSyntaxError): Renamed from yyreportParseError.
        (yyrecoverSyntaxError): Renamed from yyrecoverParseError.
        All uses changed.
        * tests/calc.at (_AT_DATA_CALC_Y): Make vars static instead of
        extern when possible.  Remove unused initializations.
        
Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.39
diff -p -u -r1.39 glr.c
--- data/glr.c  16 Nov 2002 12:32:27 -0000      1.39
+++ data/glr.c  18 Nov 2002 07:23:19 -0000
@@ -481,9 +481,9 @@ int yydebug;
 #else /* !YYDEBUG */
 
   /* Avoid empty `if' bodies.  */
-# define YYDPRINTF(Args)   {}
-# define YYDSYMPRINT(Args) {}
-# define YYDSYMPRINTF(Title, Token, Value, Location) {}
+# define YYDPRINTF(Args)
+# define YYDSYMPRINT(Args)
+# define YYDSYMPRINTF(Title, Token, Value, Location)
 
 #endif /* !YYDEBUG */
 
@@ -790,14 +790,6 @@ yyisErrorAction (int yyaction)
 
                                /* GLRStates */
 
-/** True iff the semantic value of the edge leading to STATE is
- *  resolved. */
-static inline bool
-yyhasResolvedValue (yyGLRState* yystate)
-{
-  return yystate->yyresolved;
-}
-
 static void
 yyaddDeferredAction (yyGLRStack* yystack, yyGLRState* yystate,
                     yyGLRState* rhs, yyRuleNum yyrule]b4_pure_formals[)
@@ -1250,7 +1242,7 @@ yymergeOptionSets (yySemanticOption* yyy
        yySemanticOption* yyz;
        for (yyz = yys0->yysemantics.yyfirstVal; yyz->yynext != NULL;
             yyz = yyz->yynext)
-         ;
+         continue;
        yyz->yynext = yys1->yysemantics.yyfirstVal;
       }
 }
@@ -1460,7 +1452,7 @@ yyresolveStack (yyGLRStack* yystack]b4_u
       for (yyn = 0, yys = yystack->yytops.yystates[0];
           yys != yystack->yysplitPoint;
           yys = yys->yypred, yyn += 1)
-       ;
+       continue;
       YYCHK (yyresolveStates (yystack->yytops.yystates[0], yyn, yystack
                             ]b4_user_args[));
     }
@@ -1571,8 +1563,8 @@ yyprocessOneStack (yyGLRStack* yystack, 
 }
 
 static void
-yyreportParseError (yyGLRStack* yystack,
-                   YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
+yyreportSyntaxError (yyGLRStack* yystack,
+                    YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
 {
   /* `Unused' warnings. */
   (void) yylvalp;
@@ -1630,8 +1622,8 @@ yyreportParseError (yyGLRStack* yystack,
    YYLVALP, and YYLLOCP point to the syntactic category, semantic
    value, and location of the lookahead.  */
 static void
-yyrecoverParseError (yyGLRStack* yystack,
-                    YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
+yyrecoverSyntaxError (yyGLRStack* yystack,
+                     YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
 {
   yySymbol* const yytokenp = yystack->yytokenp;
   size_t yyk;
@@ -1796,7 +1788,7 @@ yyrecoverParseError (yyGLRStack* yystack
              yyrule = yydefaultAction (yystate);
              if (yyrule == 0)
                {
-                 yyreportParseError (&yystack, yylvalp, yyllocp]b4_user_args[);
+                 yyreportSyntaxError (&yystack, yylvalp, 
yyllocp]b4_user_args[);
                  goto yyuser_error;
                }
              YYCHK1 (yyglrReduce (&yystack, 0, yyrule, yytrue]b4_lpure_args[));
@@ -1827,7 +1819,7 @@ yyrecoverParseError (yyGLRStack* yystack
                }
              else if (yyisErrorAction (yyaction))
                {
-                 yyreportParseError (&yystack, yylvalp, yyllocp]b4_user_args[);
+                 yyreportSyntaxError (&yystack, yylvalp, 
yyllocp]b4_user_args[);
                  goto yyuser_error;
                }
              else
@@ -1852,7 +1844,7 @@ yyrecoverParseError (yyGLRStack* yystack
                yyFail (&yystack][]b4_lpure_args[, "syntax error");
              YYCHK1 (yyresolveStack (&yystack]b4_user_args[));
              YYDPRINTF ((stderr, "Returning to deterministic operation.\n"));
-             yyreportParseError (&yystack, yylvalp, yyllocp]b4_user_args[);
+             yyreportSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
              goto yyuser_error;
            }
          else if (yystack.yytops.yysize == 1)
@@ -1865,7 +1857,7 @@ yyrecoverParseError (yyGLRStack* yystack
        }
       continue;
     yyuser_error:
-      yyrecoverParseError (&yystack, yylvalp, yyllocp]b4_user_args[);
+      yyrecoverSyntaxError (&yystack, yylvalp, yyllocp]b4_user_args[);
       yyposn = yystack.yytops.yystates[0]->yyposn;
     }
  yyDone:
Index: tests/calc.at
===================================================================
RCS file: /cvsroot/bison/bison/tests/calc.at,v
retrieving revision 1.45
diff -p -u -r1.45 calc.at
--- tests/calc.at       15 Nov 2002 20:32:21 -0000      1.45
+++ tests/calc.at       18 Nov 2002 07:23:20 -0000
@@ -53,8 +53,8 @@ extern void perror (const char *s);
 /* Exercise pre-prologue dependency to %union.  */
 typedef int value_t;
 
-value_t global_result = 0;
-int global_count = 0;
+static value_t global_result = 0;
+static int global_count = 0;
 
 %}
 
@@ -146,7 +146,7 @@ exp:
 ;
 %%
 /* The input. */
-FILE *yyin;
+static FILE *yyin;
 
 static void
 yyerror (]AT_YYERROR_ARG_LOC_IF([YYLTYPE *yylloc, ])[
@@ -291,8 +291,7 @@ main (int argc, const char **argv)
 {
   value_t result = 0;
   int count = 0;
-  int status = 0;
-  yyin = NULL;
+  int status;
 
   if (argc == 2)
     yyin = fopen (argv[1], "r");




reply via email to

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