* 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.
This commit is contained in:
Paul Eggert
2005-10-06 07:17:21 +00:00
parent 74e543d21f
commit 2a4647a32f
5 changed files with 62 additions and 40 deletions

View File

@@ -1,5 +1,23 @@
2005-10-05 Paul Eggert <eggert@cs.ucla.edu> 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. * data/m4sugar/m4sugar.m4 (_m4_map): New macro.
(m4_map, m4_map_sep): Use it. Handle the empty list correctly. (m4_map, m4_map_sep): Use it. Handle the empty list correctly.

View File

@@ -385,9 +385,8 @@ m4_define_default([b4_yydestruct_generate],
[[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([, [[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([,
[[YYLTYPE *yylocationp], [yylocationp]]]))[ [[YYLTYPE *yylocationp], [yylocationp]]]))[
{ {
/* Pacify ``unused variable'' warnings. */ YYUSE (yyvaluep);
(void) yyvaluep; ]b4_location_if([ YYUSE (yylocationp);
]b4_location_if([ (void) yylocationp;
])[ ])[
if (!yymsg) if (!yymsg)
yymsg = "Deleting"; yymsg = "Deleting";
@@ -420,9 +419,8 @@ m4_define_default([b4_yysymprint_generate],
[[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([, [[YYSTYPE *yyvaluep], [yyvaluep]]b4_location_if([,
[[YYLTYPE *yylocationp], [yylocationp]]])) [[YYLTYPE *yylocationp], [yylocationp]]]))
{ {
/* Pacify ``unused variable'' warnings. */ YYUSE (yyvaluep);
(void) yyvaluep; b4_location_if([ YYUSE (yylocationp);
b4_location_if([ (void) yylocationp;
])dnl ])dnl
[ [
if (yytype < YYNTOKENS) if (yytype < YYNTOKENS)

View File

@@ -234,6 +234,9 @@ b4_syncline([@oline@], [@ofile@])
# endif # endif
#endif #endif
/* Suppress unused-variable warnings by "using" E. */
#define YYUSE(e) do {;} while (/*CONSTCOND*/ yyfalse && (e))
#ifndef YYFREE #ifndef YYFREE
# define YYFREE free # define YYFREE free
#endif #endif
@@ -470,7 +473,7 @@ static const ]b4_int_type_for([b4_stos])[ yystos[] =
(Current).first_column = (Current).last_column = \ (Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \ YYRHSLOC (Rhs, 0).last_column; \
} \ } \
while (0) while (/*CONSTCOND*/ 0)
/* YY_LOCATION_PRINT -- Print the location on the stream. /* YY_LOCATION_PRINT -- Print the location on the stream.
This macro was not mandated originally: define only if we know 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) \ #define YYCHK(YYE) \
do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \ do { YYRESULTTAG yyflag = YYE; if (yyflag != yyok) return yyflag; } \
while (0) while (/*CONSTCOND*/ 0)
#if YYDEBUG #if YYDEBUG
@@ -527,7 +530,7 @@ typedef enum { yyok, yyaccept, yyabort, yyerr } YYRESULTTAG;
do { \ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (0) } while (/*CONSTCOND*/ 0)
]b4_yysymprint_generate([b4_c_ansi_function_def])[ ]b4_yysymprint_generate([b4_c_ansi_function_def])[
@@ -540,7 +543,7 @@ do { \
Type, Value]b4_location_if([, Location])[); \ Type, Value]b4_location_if([, Location])[); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (0) } while (/*CONSTCOND*/ 0)
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */ multiple parsers can coexist. */
@@ -877,9 +880,8 @@ b4_syncline([@oline@], [@ofile@])
static void static void
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
{ {
/* Suppress unused-variable warnings. */ YYUSE (yy0);
yy0 = yy0; YYUSE (yy1);
yy1 = yy1;
switch (yyn) switch (yyn)
{ {
@@ -1306,7 +1308,7 @@ yydoAction (yyGLRStack* yystack, size_t yyk, yyRuleNum yyrule,
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (K, Rule); \ yy_reduce_print (K, Rule); \
} while (0) } while (/*CONSTCOND*/ 0)
/*----------------------------------------------------------. /*----------------------------------------------------------.
| Report that the RULE is going to be reduced on stack #K. | | Report that the RULE is going to be reduced on stack #K. |
@@ -1621,9 +1623,8 @@ static void
yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1, yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1,
yyGLRStack* yystack]b4_pure_formals[) yyGLRStack* yystack]b4_pure_formals[)
{ {
/* Suppress unused-variable warnings. */ YYUSE (yyx0);
yyx0 = yyx0; YYUSE (yyx1);
yyx1 = yyx1;
#if YYDEBUG #if YYDEBUG
YYFPRINTF (stderr, "Ambiguity detected.\n"); YYFPRINTF (stderr, "Ambiguity detected.\n");
@@ -1836,9 +1837,8 @@ static void
yyreportSyntaxError (yyGLRStack* yystack, yyreportSyntaxError (yyGLRStack* yystack,
YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[) YYSTYPE* yylvalp, YYLTYPE* yyllocp]b4_user_formals[)
{ {
/* Suppress unused-variable warnings. */ YYUSE (yylvalp);
yylvalp = yylvalp; YYUSE (yyllocp);
yyllocp = yyllocp;
if (yystack->yyerrState == 0) if (yystack->yyerrState == 0)
{ {
@@ -2046,7 +2046,7 @@ yyrecoverSyntaxError (yyGLRStack* yystack,
default: \ default: \
goto yybuglab; \ goto yybuglab; \
} \ } \
} while (0) } while (/*CONSTCOND*/ 0)
/*----------. /*----------.

View File

@@ -88,7 +88,7 @@ do { \
{ \ { \
(Current).begin = (Current).end = (Rhs)[0].end; \ (Current).begin = (Current).end = (Rhs)[0].end; \
} \ } \
} while (0) } while (false)
#endif #endif
namespace yy namespace yy
@@ -319,6 +319,9 @@ b4_syncline([@oline@], [@ofile@])[
# endif # endif
#endif #endif
/* Suppress unused-variable warnings by "using" E. */
#define YYUSE(e) do {;} while (false && (e))
/* A pseudo ostream that takes yydebug_ into account. */ /* A pseudo ostream that takes yydebug_ into account. */
# define YYCDEBUG \ # define YYCDEBUG \
for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \ for (bool yydebugcond_ = yydebug_; yydebugcond_; yydebugcond_ = false) \
@@ -335,19 +338,19 @@ do { \
yysymprint_ ((Type), (Value), (Location)); \ yysymprint_ ((Type), (Value), (Location)); \
*yycdebug_ << std::endl; \ *yycdebug_ << std::endl; \
} \ } \
} while (0) } while (false)
# define YY_REDUCE_PRINT(Rule) \ # define YY_REDUCE_PRINT(Rule) \
do { \ do { \
if (yydebug_) \ if (yydebug_) \
yyreduce_print_ (Rule); \ yyreduce_print_ (Rule); \
} while (0) } while (false)
# define YY_STACK_PRINT() \ # define YY_STACK_PRINT() \
do { \ do { \
if (yydebug_) \ if (yydebug_) \
yystack_print_ (); \ yystack_print_ (); \
} while (0) } while (false)
#else /* !YYDEBUG */ #else /* !YYDEBUG */
@@ -414,9 +417,9 @@ yy::]b4_parser_class_name[::yysymprint_ (int yytype,
/* Backward compatibility, but should be removed eventually. */ /* Backward compatibility, but should be removed eventually. */
std::ostream& cdebug_ = *yycdebug_; std::ostream& cdebug_ = *yycdebug_;
/* Suppress unused-variable warnings. */ YYUSE (!&cdebug_);
if (false) YYUSE (yylocationp);
yysymprint_ (yytype + !&cdebug_, yyvaluep, yylocationp); YYUSE (yyvaluep);
*yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm") *yycdebug_ << (yytype < yyntokens_ ? "token" : "nterm")
<< ' ' << yytname_[yytype] << " (" << ' ' << yytname_[yytype] << " ("
@@ -435,9 +438,9 @@ void
yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg, yy::]b4_parser_class_name[::yydestruct_ (const char* yymsg,
int yytype, semantic_type* yyvaluep, location_type* yylocationp) int yytype, semantic_type* yyvaluep, location_type* yylocationp)
{ {
/* Suppress unused-variable warnings. */ YYUSE (yylocationp);
if (false) YYUSE (yymsg);
yydestruct_ (yymsg, yytype, yyvaluep, yylocationp); YYUSE (yyvaluep);
YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);

View File

@@ -246,6 +246,9 @@ b4_syncline([@oline@], [@ofile@])[
# endif # endif
#endif #endif
/* Suppress unused-variable warnings by "using" E. */
#define YYUSE(e) do {;} while (/*CONSTCOND*/ 0 && (e))
#if ! defined (yyoverflow) || YYERROR_VERBOSE #if ! defined (yyoverflow) || YYERROR_VERBOSE
/* The parser invokes alloca or malloc; define the necessary symbols. */ /* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -355,7 +358,7 @@ union yyalloc
for (yyi = 0; yyi < (Count); yyi++) \ for (yyi = 0; yyi < (Count); yyi++) \
(To)[yyi] = (From)[yyi]; \ (To)[yyi] = (From)[yyi]; \
} \ } \
while (0) while (/*CONSTCOND*/ 0)
# endif # endif
# endif # endif
@@ -373,7 +376,7 @@ union yyalloc
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \ yyptr += yynewbytes / sizeof (*yyptr); \
} \ } \
while (0) while (/*CONSTCOND*/ 0)
#endif #endif
@@ -544,7 +547,7 @@ do \
yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \ yyerror (]b4_yyerror_args[YY_("syntax error: cannot back up")); \
YYERROR; \ YYERROR; \
} \ } \
while (0) while (/*CONSTCOND*/ 0)
#define YYTERROR 1 #define YYTERROR 1
@@ -573,7 +576,7 @@ while (0)
(Current).first_column = (Current).last_column = \ (Current).first_column = (Current).last_column = \
YYRHSLOC (Rhs, 0).last_column; \ YYRHSLOC (Rhs, 0).last_column; \
} \ } \
while (0) while (/*CONSTCOND*/ 0)
#endif #endif
@@ -613,7 +616,7 @@ while (0)
do { \ do { \
if (yydebug) \ if (yydebug) \
YYFPRINTF Args; \ YYFPRINTF Args; \
} while (0) } while (/*CONSTCOND*/ 0)
# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
do { \ do { \
@@ -624,7 +627,7 @@ do { \
Type, Value]b4_location_if([, Location])[); \ Type, Value]b4_location_if([, Location])[); \
YYFPRINTF (stderr, "\n"); \ YYFPRINTF (stderr, "\n"); \
} \ } \
} while (0) } while (/*CONSTCOND*/ 0)
/*------------------------------------------------------------------. /*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its | | yy_stack_print -- Print the state stack from its BOTTOM up to its |
@@ -645,7 +648,7 @@ do { \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_stack_print ((Bottom), (Top)); \ yy_stack_print ((Bottom), (Top)); \
} while (0) } while (/*CONSTCOND*/ 0)
/*------------------------------------------------. /*------------------------------------------------.
@@ -669,7 +672,7 @@ do { \
do { \ do { \
if (yydebug) \ if (yydebug) \
yy_reduce_print (Rule); \ yy_reduce_print (Rule); \
} while (0) } while (/*CONSTCOND*/ 0)
/* Nonzero means print parse trace. It is left uninitialized so that /* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */ multiple parsers can coexist. */
@@ -1351,7 +1354,7 @@ yyerrorlab:
/* Pacify compilers like GCC when the user code never invokes /* Pacify compilers like GCC when the user code never invokes
YYERROR and the label yyerrorlab therefore never appears in user YYERROR and the label yyerrorlab therefore never appears in user
code. */ code. */
if (0) if (/*CONSTCOND*/ 0)
goto yyerrorlab; goto yyerrorlab;
]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen]; ]b4_location_if([[ yyerror_range[0] = yylsp[1-yylen];