]> git.saurik.com Git - bison.git/commitdiff
* data/c.m4 (yydestruct, yysymprint):
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 6 Oct 2005 07:17:21 +0000 (07:17 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 6 Oct 2005 07:17:21 +0000 (07:17 +0000)
Use YYUSE instead of casting to void.
* data/glr.c (YYUSE): New macro.
(yyuserMerge, yyreportAmbiguity, yyreportSyntaxError):
Use it instead of rolling our own.
(YYLLOC_DEFAULT, YYCHK, YYDPRINTF, YY_SYMBOL_PRINT, YY_REDUCE_PRINT):
(YYCHK1):
Use /*CONSTCOND*/ to suppress lint warnings.
* data/lalr1.cc (YYLLOC_DEFAULT, YY_SYMBOL_PRINT, YY_REDUCE_PRINT):
(YY_STACK_PRINT): Use 'false' not '0'.
(YYUSE): New macro.
(yysymprint_, yydestruct_): Use it instead of rolling our own.
* data/yacc.c (YYUSE): New macro.
(YYCOPY, YYSTACK_RELOCATE, YYBACKUP, YYLLOC_DEFAULT):
(YYDPRINTF, YY_SYMBOL_PRINT, YY_STACK_PRINT, YY_REDUCE_PRINT):
(yyerrorlab): Use /*CONSTCOND*/ to suppress lint warnings.

ChangeLog
data/c.m4
data/glr.c
data/lalr1.cc
data/yacc.c

index e7dd36687fc22bc69417f7a47c53515e2552e304..f658dca5b22797ac339bf94d975f3865b07db82d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 2005-10-05  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * data/c.m4 (yydestruct, yysymprint):
+       Use YYUSE instead of casting to void.
+       * data/glr.c (YYUSE): New macro.
+       (yyuserMerge, yyreportAmbiguity, yyreportSyntaxError):
+       Use it instead of rolling our own.
+       (YYLLOC_DEFAULT, YYCHK, YYDPRINTF, YY_SYMBOL_PRINT, YY_REDUCE_PRINT):
+       (YYCHK1):
+       Use /*CONSTCOND*/ to suppress lint warnings.
+       * data/lalr1.cc (YYLLOC_DEFAULT, YY_SYMBOL_PRINT, YY_REDUCE_PRINT):
+       (YY_STACK_PRINT): Use 'false' not '0'.
+       (YYUSE): New macro.
+       (yysymprint_, yydestruct_): Use it instead of rolling our own.
+       * data/yacc.c (YYUSE): New macro.
+       (YYCOPY, YYSTACK_RELOCATE, YYBACKUP, YYLLOC_DEFAULT):
+       (YYDPRINTF, YY_SYMBOL_PRINT, YY_STACK_PRINT, YY_REDUCE_PRINT):
+       (yyerrorlab): Use /*CONSTCOND*/ to suppress lint warnings.
+
+
        * data/m4sugar/m4sugar.m4 (_m4_map): New macro.
        (m4_map, m4_map_sep): Use it.  Handle the empty list correctly.
 
index 03f20ff79616dffc9a35b31155f3cc736d9d5fc8..604ad1386608be8333d74e2f9a092e6928682539 100644 (file)
--- a/data/c.m4
+++ b/data/c.m4
@@ -385,9 +385,8 @@ m4_define_default([b4_yydestruct_generate],
     [[YYSTYPE *yyvaluep],    [yyvaluep]]b4_location_if([,
     [[YYLTYPE *yylocationp], [yylocationp]]]))[
 {
-  /* Pacify ``unused variable'' warnings.  */
-  (void) yyvaluep;
-]b4_location_if([  (void) yylocationp;
+  YYUSE (yyvaluep);
+]b4_location_if([  YYUSE (yylocationp);
 ])[
   if (!yymsg)
     yymsg = "Deleting";
@@ -420,9 +419,8 @@ m4_define_default([b4_yysymprint_generate],
     [[YYSTYPE *yyvaluep],    [yyvaluep]]b4_location_if([,
     [[YYLTYPE *yylocationp], [yylocationp]]]))
 {
-  /* Pacify ``unused variable'' warnings.  */
-  (void) yyvaluep;
-b4_location_if([  (void) yylocationp;
+  YYUSE (yyvaluep);
+b4_location_if([  YYUSE (yylocationp);
 ])dnl
 [
   if (yytype < YYNTOKENS)
index 848579b68d47f3dba84d30b86c826ed092e07289..877e400960ac69f36396dc32a89a3f0415938527 100644 (file)
@@ -234,6 +234,9 @@ b4_syncline([@oline@], [@ofile@])
 # endif
 #endif
 
+/* Suppress unused-variable warnings by "using" E.  */
+#define YYUSE(e) do {;} while (/*CONSTCOND*/ yyfalse && (e))
+
 #ifndef YYFREE
 # define YYFREE free
 #endif
@@ -470,7 +473,7 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
          (Current).first_column = (Current).last_column =              \
            YYRHSLOC (Rhs, 0).last_column;                              \
        }                                                               \
-    while (0)
+    while (/*CONSTCOND*/ 0)
 
 /* YY_LOCATION_PRINT -- Print the location on the stream.
    This macro was not mandated originally: define only if we know
@@ -515,7 +518,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
 
 #define YYCHK(YYE)                                                          \
    do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; }      \
-   while (0)
+   while (/*CONSTCOND*/ 0)
 
 #if YYDEBUG
 
@@ -527,7 +530,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
 do {                                           \
   if (yydebug)                                 \
     YYFPRINTF Args;                            \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 ]b4_yysymprint_generate([b4_c_ansi_function_def])[
 
@@ -540,7 +543,7 @@ do {                                                                \
                   Type, Value]b4_location_if([, Location])[);  \
       YYFPRINTF (stderr, "\n");                                        \
     }                                                          \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -877,9 +880,8 @@ b4_syncline([@oline@], [@ofile@])
 static void
 yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
 {
-  /* Suppress unused-variable warnings.  */
-  yy0 = yy0;
-  yy1 = yy1;
+  YYUSE (yy0);
+  YYUSE (yy1);
 
   switch (yyn)
     {
@@ -1306,7 +1308,7 @@ yydoAction (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
 do {                                   \
   if (yydebug)                         \
     yy_reduce_print (K, Rule);         \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 /*----------------------------------------------------------.
 | Report that the RULE is going to be reduced on stack #K.  |
@@ -1621,9 +1623,8 @@ static void
 yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
                   yyGLRStack* yystack]b4_pure_formals[)
 {
-  /* Suppress unused-variable warnings.  */
-  yyx0 = yyx0;
-  yyx1 = yyx1;
+  YYUSE (yyx0);
+  YYUSE (yyx1);
 
 #if YYDEBUG
   YYFPRINTF (stderr, "Ambiguity detected.\n");
@@ -1836,9 +1837,8 @@ static void
 yyreportSyntaxError (yyGLRStack* yystack,
                     YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
 {
-  /* Suppress unused-variable warnings.  */
-  yylvalp = yylvalp;
-  yyllocp = yyllocp;
+  YYUSE (yylvalp);
+  YYUSE (yyllocp);
 
   if (yystack->yyerrState == 0)
     {
@@ -2046,7 +2046,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
     default:                                                                \
       goto yybuglab;                                                        \
     }                                                                       \
-  } while (0)
+  } while (/*CONSTCOND*/ 0)
 
 
 /*----------.
index 01fbcd0fe3ab3fb7f25e3f3e1848e66e5124966e..91bc2ec493b40c2b9dd5bd592ce2393b6b85007d 100644 (file)
@@ -88,7 +88,7 @@ do {                                                  \
     {                                                  \
       (Current).begin = (Current).end = (Rhs)[0].end;  \
     }                                                  \
-} while (0)
+} while (false)
 #endif
 
 namespace yy
@@ -319,6 +319,9 @@ b4_syncline([@oline@], [@ofile@])[
 # endif
 #endif
 
+/* Suppress unused-variable warnings by "using" E.  */
+#define YYUSE(e) do {;} while (false && (e))
+
 /* A pseudo ostream that takes yydebug_ into account. */
 # define YYCDEBUG                                                      \
   for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false)       \
@@ -335,19 +338,19 @@ do {                                                      \
       yysymprint_ ((Type), (Value), (Location));       \
       *yycdebug_ << std::endl;                         \
     }                                                  \
-} while (0)
+} while (false)
 
 # define YY_REDUCE_PRINT(Rule)         \
 do {                                   \
   if (yydebug_)                                \
     yyreduce_print_ (Rule);            \
-} while (0)
+} while (false)
 
 # define YY_STACK_PRINT()              \
 do {                                   \
   if (yydebug_)                                \
     yystack_print_ ();                 \
-} while (0)
+} while (false)
 
 #else /* !YYDEBUG */
 
@@ -414,9 +417,9 @@ yy::]b4_parser_class_name[::yysymprint_ (int yytype,
   /* Backward compatibility, but should be removed eventually. */
   std::ostream& cdebug_ = *yycdebug_;
 
-  /* Suppress unused-variable warnings.  */
-  if (false)
-    yysymprint_ (yytype + !&cdebug_, yyvaluep, yylocationp);
+  YYUSE (!&cdebug_);
+  YYUSE (yylocationp);
+  YYUSE (yyvaluep);
 
   *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
             << ' ' << yytname_[yytype] << " ("
@@ -435,9 +438,9 @@ void
 yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg,
                          int yytype, semantic_type* yyvaluep, location_type* yylocationp)
 {
-  /* Suppress unused-variable warnings.  */
-  if (false)
-    yydestruct_ (yymsg, yytype, yyvaluep, yylocationp);
+  YYUSE (yylocationp);
+  YYUSE (yymsg);
+  YYUSE (yyvaluep);
 
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
index cbce25b18c35d2e706e32d4d40aeb3b95ed281c2..1a141108659772fd7e62f2f3344843e7e80b1423 100644 (file)
@@ -246,6 +246,9 @@ b4_syncline([@oline@], [@ofile@])[
 # endif
 #endif
 
+/* Suppress unused-variable warnings by "using" E.  */
+#define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
+
 #if ! defined (yyoverflow) || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
@@ -355,7 +358,7 @@ union yyalloc
          for (yyi = 0; yyi < (Count); yyi++)   \
            (To)[yyi] = (From)[yyi];            \
        }                                       \
-      while (0)
+      while (/*CONSTCOND*/ 0)
 #  endif
 # endif
 
@@ -373,7 +376,7 @@ union yyalloc
        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
        yyptr += yynewbytes / sizeof (*yyptr);                          \
       }                                                                        \
-    while (0)
+    while (/*CONSTCOND*/ 0)
 
 #endif
 
@@ -544,7 +547,7 @@ do                                                          \
       yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
       YYERROR;                                                 \
     }                                                          \
-while (0)
+while (/*CONSTCOND*/ 0)
 
 
 #define YYTERROR       1
@@ -573,7 +576,7 @@ while (0)
          (Current).first_column = (Current).last_column =              \
            YYRHSLOC (Rhs, 0).last_column;                              \
        }                                                               \
-    while (0)
+    while (/*CONSTCOND*/ 0)
 #endif
 
 
@@ -613,7 +616,7 @@ while (0)
 do {                                           \
   if (yydebug)                                 \
     YYFPRINTF Args;                            \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)         \
 do {                                                           \
@@ -624,7 +627,7 @@ do {                                                                \
                   Type, Value]b4_location_if([, Location])[);  \
       YYFPRINTF (stderr, "\n");                                        \
     }                                                          \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 /*------------------------------------------------------------------.
 | yy_stack_print -- Print the state stack from its BOTTOM up to its |
@@ -645,7 +648,7 @@ do {                                                                \
 do {                                                           \
   if (yydebug)                                                 \
     yy_stack_print ((Bottom), (Top));                          \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 
 /*------------------------------------------------.
@@ -669,7 +672,7 @@ do {                                                                \
 do {                                   \
   if (yydebug)                         \
     yy_reduce_print (Rule);            \
-} while (0)
+} while (/*CONSTCOND*/ 0)
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -1351,7 +1354,7 @@ yyerrorlab:
   /* Pacify compilers like GCC when the user code never invokes
      YYERROR and the label yyerrorlab therefore never appears in user
      code.  */
-  if (0)
+  if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
 ]b4_location_if([[  yyerror_range[0] = yylsp[1-yylen];