From 11f6839645fcac9d4ac3470f19e385d312e10b8d Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 23 Jan 2021 09:42:24 +0100 Subject: [PATCH] style: YYUSE is private, make it YY_USE This macro is not exposed to users, make start it with 'YY_'. * data/skeletons/bison.m4, data/skeletons/c.m4, data/skeletons/glr.c, * data/skeletons/glr.cc, data/skeletons/lalr1.cc, * src/parse-gram.c, tests/actions.at, tests/c++.at, tests/headers.at, * tests/local.at (YYUSE): Rename as... (YY_USE): this. --- data/skeletons/bison.m4 | 2 +- data/skeletons/c.m4 | 12 ++++++------ data/skeletons/glr.c | 14 +++++++------- data/skeletons/glr.cc | 6 +++--- data/skeletons/lalr1.cc | 4 ++-- src/parse-gram.c | 16 ++++++++-------- src/parse-gram.h | 2 +- tests/actions.at | 8 ++++---- tests/c++.at | 6 +++--- tests/headers.at | 2 +- tests/local.at | 6 +++--- 11 files changed, 39 insertions(+), 39 deletions(-) diff --git a/data/skeletons/bison.m4 b/data/skeletons/bison.m4 index 7ab1cb91..12155123 100644 --- a/data/skeletons/bison.m4 +++ b/data/skeletons/bison.m4 @@ -537,7 +537,7 @@ m4_defn([b4_actions_])[]dnl break; }dnl ], -[YYUSE (m4_default([$2], [yykind]));])dnl +[YY_USE (m4_default([$2], [yykind]));])dnl m4_popdef([b4_actions_])dnl ]) diff --git a/data/skeletons/c.m4 b/data/skeletons/c.m4 index 8c08b0a5..8a5c851b 100644 --- a/data/skeletons/c.m4 +++ b/data/skeletons/c.m4 @@ -160,11 +160,11 @@ m4_popdef([$1])dnl # b4_parse_param_use([VAL], [LOC]) # -------------------------------- -# 'YYUSE' VAL, LOC if locations are enabled, and all the parse-params. +# 'YY_USE' VAL, LOC if locations are enabled, and all the parse-params. m4_define([b4_parse_param_use], -[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl -b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl -b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); +[m4_ifvaln([$1], [ YY_USE ([$1]);])dnl +b4_locations_if([m4_ifvaln([$2], [ YY_USE ([$2]);])])dnl +b4_parse_param_for([Decl], [Formal], [ YY_USE (Formal); ])dnl ]) @@ -398,9 +398,9 @@ dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings. ]])[/* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ diff --git a/data/skeletons/glr.c b/data/skeletons/glr.c index 1456b4ec..5034b5ef 100644 --- a/data/skeletons/glr.c +++ b/data/skeletons/glr.c @@ -875,7 +875,7 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; int yylow; ]b4_parse_param_use([yyvalp], [yylocp])dnl -[ YYUSE (yyrhslen); +[ YY_USE (yyrhslen); # undef yyerrok # define yyerrok (yystackp->yyerrState = 0) # undef YYACCEPT @@ -939,8 +939,8 @@ yyuserAction (yyRuleNum yyn, int yyrhslen, yyGLRStackItem* yyvsp, static void yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) { - YYUSE (yy0); - YYUSE (yy1); + YY_USE (yy0); + YY_USE (yy1); switch (yyn) { @@ -1795,8 +1795,8 @@ static YYRESULTTAG yyreportAmbiguity (yySemanticOption* yyx0, yySemanticOption* yyx1]b4_pure_formals[) { - YYUSE (yyx0); - YYUSE (yyx1); + YY_USE (yyx0); + YY_USE (yyx1); #if ]b4_api_PREFIX[DEBUG YY_FPRINTF ((stderr, "Ambiguity detected.\n")); @@ -2140,7 +2140,7 @@ yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED; static yysymbol_kind_t yypcontext_token (const yyGLRStack *yystackp) { - YYUSE (yystackp); + YY_USE (yystackp); yysymbol_kind_t yytoken = yychar == ]b4_symbol(-2, id)[ ? ]b4_symbol(-2, kind)[ : YYTRANSLATE (yychar); return yytoken; } @@ -2152,7 +2152,7 @@ yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED; static YYLTYPE * yypcontext_location (const yyGLRStack *yystackp) { - YYUSE (yystackp); + YY_USE (yystackp); return &yylloc; }]])], [detailed\|verbose], diff --git a/data/skeletons/glr.cc b/data/skeletons/glr.cc index cf2c4c20..cfff9773 100644 --- a/data/skeletons/glr.cc +++ b/data/skeletons/glr.cc @@ -157,11 +157,11 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl const semantic_type* yyvaluep]b4_locations_if([[, const location_type* yylocationp]])[) const {]b4_locations_if([[ - YYUSE (yylocationp);]])[ - YYUSE (yyvaluep); + YY_USE (yylocationp);]])[ + YY_USE (yyvaluep); std::ostream& yyo = debug_stream (); std::ostream& yyoutput = yyo; - YYUSE (yyoutput); + YY_USE (yyoutput); ]b4_symbol_actions([printer])[ } diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc index 6214f96f..c62c77d2 100644 --- a/data/skeletons/lalr1.cc +++ b/data/skeletons/lalr1.cc @@ -597,7 +597,7 @@ m4_if(b4_prefix, [yy], [], #else // !]b4_api_PREFIX[DEBUG # define YYCDEBUG if (false) std::cerr -# define YY_SYMBOL_PRINT(Title, Symbol) YYUSE (Symbol) +# define YY_SYMBOL_PRINT(Title, Symbol) YY_USE (Symbol) # define YY_REDUCE_PRINT(Rule) static_cast (0) # define YY_STACK_PRINT() static_cast (0) @@ -736,7 +736,7 @@ m4_if(b4_prefix, [yy], [], ]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol& yysym) const { std::ostream& yyoutput = yyo; - YYUSE (yyoutput); + YY_USE (yyoutput); if (yysym.empty ()) yyo << "empty symbol"; else diff --git a/src/parse-gram.c b/src/parse-gram.c index 3071f803..5b1ac0a6 100644 --- a/src/parse-gram.c +++ b/src/parse-gram.c @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.4.6-89d2b-dirty. */ +/* A Bison parser, made by GNU Bison 3.7.4.23-44a69. */ /* Bison implementation for Yacc-like parsers in C @@ -49,7 +49,7 @@ #define YYBISON 30704 /* Bison version string. */ -#define YYBISON_VERSION "3.7.4.6-89d2b-dirty" +#define YYBISON_VERSION "3.7.4.23-44a69" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -478,9 +478,9 @@ typedef int yy_state_fast_t; /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ @@ -1072,8 +1072,8 @@ yy_symbol_value_print (FILE *yyo, yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) { FILE *yyoutput = yyo; - YYUSE (yyoutput); - YYUSE (yylocationp); + YY_USE (yyoutput); + YY_USE (yylocationp); if (!yyvaluep) return; # ifdef YYPRINT @@ -1701,8 +1701,8 @@ static void yydestruct (const char *yymsg, yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) { - YYUSE (yyvaluep); - YYUSE (yylocationp); + YY_USE (yyvaluep); + YY_USE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); diff --git a/src/parse-gram.h b/src/parse-gram.h index fcab0ce6..7dbd0ffd 100644 --- a/src/parse-gram.h +++ b/src/parse-gram.h @@ -1,4 +1,4 @@ -/* A Bison parser, made by GNU Bison 3.7.4.6-89d2b-dirty. */ +/* A Bison parser, made by GNU Bison 3.7.4.23-44a69. */ /* Bison interface for Yacc-like parsers in C diff --git a/tests/actions.at b/tests/actions.at index d90851de..da11ceb2 100644 --- a/tests/actions.at +++ b/tests/actions.at @@ -334,10 +334,10 @@ exp: { ]AT_CXX_IF([[std::cerr << @$ << '\n']], ]AT_YYLEX_PROTOTYPE[ {]AT_PURE_IF([ - YYUSE(lvalp); - YYUSE(llocp);], [AT_CXX_IF([ - YYUSE(lvalp); - YYUSE(llocp);])])[ + YY_USE(lvalp); + YY_USE(llocp);], [AT_CXX_IF([ + YY_USE(lvalp); + YY_USE(llocp);])])[ return 'x'; } diff --git a/tests/c++.at b/tests/c++.at index 949bdeb6..b894c0f7 100644 --- a/tests/c++.at +++ b/tests/c++.at @@ -1232,10 +1232,10 @@ list: item: 'a' { $$ = $][1; } -| 'e' { YYUSE ($$); YYUSE ($][1); error ("syntax error"); } +| 'e' { YY_USE ($$); YY_USE ($][1); error ("syntax error"); } // Not just 'E', otherwise we reduce when 'E' is the lookahead, and // then the stack is emptied, defeating the point of the test. -| 'E' 'a' { YYUSE ($][1); $$ = $][2; } +| 'E' 'a' { YY_USE ($][1); $$ = $][2; } | 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; } | 'p' { $$ = $][1; } | 's' { $$ = $][1; throw std::runtime_error ("reduction"); } @@ -1394,7 +1394,7 @@ int yylex (yy::parser::semantic_type *lvalp) // Note: this argument is unused, but named on purpose. There used to be a // bug with a macro that erroneously expanded this identifier to // yystackp->yyval. - YYUSE (lvalp); + YY_USE (lvalp); return yy::parser::token::ZERO; } diff --git a/tests/headers.at b/tests/headers.at index 73a43454..4e745ccb 100644 --- a/tests/headers.at +++ b/tests/headers.at @@ -340,7 +340,7 @@ AT_PERL_CHECK([[-n -0777 -e ' |YYNTOKENS # This is actual scoped in a C++ class. |YYPUSH_MORE(?:_DEFINED)? |S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped. - |YYUSE + |YY_USE |YY_ATTRIBUTE(?:_PURE|_UNUSED) |YY(?:_REINTERPRET)?_CAST |YY_CONSTEXPR diff --git a/tests/local.at b/tests/local.at index 91e1e734..c697f5a7 100644 --- a/tests/local.at +++ b/tests/local.at @@ -643,7 +643,7 @@ yyreport_syntax_error (const yypcontext_t *ctx]AT_PARAM_IF([, AT_PARSE_PARAMS])[ { int res = 0;]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ - YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ + YY_USE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ ++global_nerrs; ++*nerrs;]])[]AT_LOCATION_IF([[ LOCATION_PRINT (stderr, *yypcontext_location (ctx)); @@ -679,7 +679,7 @@ static ]AT_YYERROR_PROTOTYPE[ {]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ - YYUSE (\1);])dnl + YY_USE (\1);])dnl AT_YYERROR_SEES_LOC_IF([[ LOCATION_PRINT (stderr, ]AT_LOC[); fprintf (stderr, ": ");]])[ @@ -760,7 +760,7 @@ void ]AT_NAMESPACE[::parser::report_syntax_error (const context& ctx) const {]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), [[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ - YYUSE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ + YY_USE (\1);])])[]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ ++global_nerrs; ++*nerrs;]])[]AT_LOCATION_IF([[ std::cerr << ctx.location () << ": ";]])[