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/glr2.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.
This commit is contained in:
Akim Demaille
2021-01-03 10:46:41 +01:00
parent c1884d3002
commit e2199d0fb2
11 changed files with 57 additions and 57 deletions

View File

@@ -555,7 +555,7 @@ m4_defn([b4_actions_])[]dnl
break; break;
}dnl }dnl
], ],
[YYUSE (m4_default([$2], [yykind]));])dnl [YY_USE (m4_default([$2], [yykind]));])dnl
m4_popdef([b4_actions_])dnl m4_popdef([b4_actions_])dnl
]) ])

View File

@@ -165,11 +165,11 @@ m4_popdef([$1])dnl
# b4_parse_param_use([VAL], [LOC]) # 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_define([b4_parse_param_use],
[m4_ifvaln([$1], [ YYUSE ([$1]);])dnl [m4_ifvaln([$1], [ YY_USE ([$1]);])dnl
b4_locations_if([m4_ifvaln([$2], [ YYUSE ([$2]);])])dnl b4_locations_if([m4_ifvaln([$2], [ YY_USE ([$2]);])])dnl
b4_parse_param_for([Decl], [Formal], [ YYUSE (Formal); b4_parse_param_for([Decl], [Formal], [ YY_USE (Formal);
])dnl ])dnl
]) ])
@@ -389,9 +389,9 @@ dnl use C' _Noreturn in C++, to avoid -Wc11-extensions warnings.
]])[/* Suppress unused-variable warnings by "using" E. */ ]])[/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E)) # define YY_USE(E) ((void) (E))
#else #else
# define YYUSE(E) /* empty */ # define YY_USE(E) /* empty */
#endif #endif
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ /* Suppress an incorrect diagnostic about yylval being uninitialized. */

View File

@@ -907,8 +907,8 @@ yyuserAction (yyRuleNum yyrule, int yyrhslen, yyGLRStackItem* yyvsp,
const yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR; const yybool yynormal YY_ATTRIBUTE_UNUSED = yystackp->yysplitPoint == YY_NULLPTR;
int yylow = 1; int yylow = 1;
]b4_parse_param_use([yyvalp], [yylocp])dnl ]b4_parse_param_use([yyvalp], [yylocp])dnl
[ YYUSE (yyk); [ YY_USE (yyk);
YYUSE (yyrhslen); YY_USE (yyrhslen);
# undef yyerrok # undef yyerrok
# define yyerrok (yystackp->yyerrState = 0) # define yyerrok (yystackp->yyerrState = 0)
# undef YYACCEPT # undef YYACCEPT
@@ -975,8 +975,8 @@ yyuserAction (yyRuleNum yyrule, int yyrhslen, yyGLRStackItem* yyvsp,
static void static void
yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1) yyuserMerge (int yyn, YYSTYPE* yy0, YYSTYPE* yy1)
{ {
YYUSE (yy0); YY_USE (yy0);
YYUSE (yy1); YY_USE (yy1);
switch (yyn) switch (yyn)
{ {
@@ -1814,8 +1814,8 @@ static YYRESULTTAG
yyreportAmbiguity (yySemanticOption* yyx0, yyreportAmbiguity (yySemanticOption* yyx0,
yySemanticOption* yyx1]b4_pure_formals[) yySemanticOption* yyx1]b4_pure_formals[)
{ {
YYUSE (yyx0); YY_USE (yyx0);
YYUSE (yyx1); YY_USE (yyx1);
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
YY_FPRINTF ((stderr, "Ambiguity detected.\n")); YY_FPRINTF ((stderr, "Ambiguity detected.\n"));
@@ -2165,7 +2165,7 @@ yypcontext_token (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
static yysymbol_kind_t static yysymbol_kind_t
yypcontext_token (const yyGLRStack *yystackp) yypcontext_token (const yyGLRStack *yystackp)
{ {
YYUSE (yystackp); YY_USE (yystackp);
yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar); yysymbol_kind_t yytoken = yychar == ]b4_symbol(empty, id)[ ? ]b4_symbol(empty, kind)[ : YYTRANSLATE (yychar);
return yytoken; return yytoken;
} }
@@ -2177,7 +2177,7 @@ yypcontext_location (const yyGLRStack *yystackp) YY_ATTRIBUTE_UNUSED;
static YYLTYPE * static YYLTYPE *
yypcontext_location (const yyGLRStack *yystackp) yypcontext_location (const yyGLRStack *yystackp)
{ {
YYUSE (yystackp); YY_USE (yystackp);
return &yylloc; return &yylloc;
}]])], }]])],
[detailed\|verbose], [detailed\|verbose],

View File

@@ -157,11 +157,11 @@ m4_pushdef([b4_parse_param], m4_defn([b4_parse_param_orig]))dnl
const value_type* yyvaluep]b4_locations_if([[, const value_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[) const const location_type* yylocationp]])[) const
{]b4_locations_if([[ {]b4_locations_if([[
YYUSE (yylocationp);]])[ YY_USE (yylocationp);]])[
YYUSE (yyvaluep); YY_USE (yyvaluep);
std::ostream& yyo = debug_stream (); std::ostream& yyo = debug_stream ();
std::ostream& yyoutput = yyo; std::ostream& yyoutput = yyo;
YYUSE (yyoutput); YY_USE (yyoutput);
]b4_symbol_actions([printer])[ ]b4_symbol_actions([printer])[
} }

View File

@@ -1859,8 +1859,8 @@ public:
yyreportAmbiguity (const semantic_option& yyx0, yyreportAmbiguity (const semantic_option& yyx0,
const semantic_option& yyx1, ]b4_namespace_ref[::]b4_parser_class[& yyparser]b4_locations_if([, const location_type& yyloc])[) const semantic_option& yyx1, ]b4_namespace_ref[::]b4_parser_class[& yyparser]b4_locations_if([, const location_type& yyloc])[)
{ {
YYUSE (yyx0); YY_USE (yyx0);
YYUSE (yyx1); YY_USE (yyx1);
#if ]b4_api_PREFIX[DEBUG #if ]b4_api_PREFIX[DEBUG
std::cerr << "Ambiguity detected.\n" std::cerr << "Ambiguity detected.\n"
@@ -2286,8 +2286,8 @@ public:
bool yynormal YY_ATTRIBUTE_UNUSED = !yystateStack.isSplit(); bool yynormal YY_ATTRIBUTE_UNUSED = !yystateStack.isSplit();
int yylow = 1; int yylow = 1;
]b4_parse_param_use([yyvalp], [yylocp])dnl ]b4_parse_param_use([yyvalp], [yylocp])dnl
[ YYUSE (yyk); [ YY_USE (yyk);
YYUSE (yyrhslen); YY_USE (yyrhslen);
# undef yyerrok # undef yyerrok
# define yyerrok (yyerrState = 0) # define yyerrok (yyerrState = 0)
# undef YYACCEPT # undef YYACCEPT
@@ -2578,8 +2578,8 @@ private:
static void static void
yyuserMerge (int yyn, value_type* yy0, value_type* yy1) yyuserMerge (int yyn, value_type* yy0, value_type* yy1)
{ {
YYUSE (yy0); YY_USE (yy0);
YYUSE (yy1); YY_USE (yy1);
switch (yyn) switch (yyn)
{ {
@@ -3228,12 +3228,12 @@ b4_dollar_popdef])[]dnl
const value_type* yyvaluep]b4_locations_if([[, const value_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[) const location_type* yylocationp]])[)
{ {
YYUSE (yyvaluep);]b4_locations_if([[ YY_USE (yyvaluep);]b4_locations_if([[
YYUSE (yylocationp);]])[ YY_USE (yylocationp);]])[
if (!yymsg) if (!yymsg)
yymsg = "Deleting"; yymsg = "Deleting";
]b4_parser_class[& yyparser = *this; ]b4_parser_class[& yyparser = *this;
YYUSE (yyparser); YY_USE (yyparser);
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
@@ -3251,11 +3251,11 @@ b4_dollar_popdef])[]dnl
const value_type* yyvaluep]b4_locations_if([[, const value_type* yyvaluep]b4_locations_if([[,
const location_type* yylocationp]])[) const const location_type* yylocationp]])[) const
{]b4_locations_if([[ {]b4_locations_if([[
YYUSE (yylocationp);]])[ YY_USE (yylocationp);]])[
YYUSE (yyvaluep); YY_USE (yyvaluep);
std::ostream& yyo = debug_stream (); std::ostream& yyo = debug_stream ();
std::ostream& yyoutput = yyo; std::ostream& yyoutput = yyo;
YYUSE (yyoutput); YY_USE (yyoutput);
]b4_symbol_actions([printer])[ ]b4_symbol_actions([printer])[
} }

View File

@@ -605,7 +605,7 @@ m4_if(b4_prefix, [yy], [],
#else // !]b4_api_PREFIX[DEBUG #else // !]b4_api_PREFIX[DEBUG
# define YYCDEBUG if (false) std::cerr # 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<void> (0) # define YY_REDUCE_PRINT(Rule) static_cast<void> (0)
# define YY_STACK_PRINT() static_cast<void> (0) # define YY_STACK_PRINT() static_cast<void> (0)
@@ -744,7 +744,7 @@ m4_if(b4_prefix, [yy], [],
]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const ]b4_parser_class[::yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const
{ {
std::ostream& yyoutput = yyo; std::ostream& yyoutput = yyo;
YYUSE (yyoutput); YY_USE (yyoutput);
if (yysym.empty ()) if (yysym.empty ())
yyo << "empty symbol"; yyo << "empty symbol";
else else

View File

@@ -468,9 +468,9 @@ typedef int yy_state_fast_t;
/* Suppress unused-variable warnings by "using" E. */ /* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__ #if ! defined lint || defined __GNUC__
# define YYUSE(E) ((void) (E)) # define YY_USE(E) ((void) (E))
#else #else
# define YYUSE(E) /* empty */ # define YY_USE(E) /* empty */
#endif #endif
/* Suppress an incorrect diagnostic about yylval being uninitialized. */ /* Suppress an incorrect diagnostic about yylval being uninitialized. */
@@ -1070,8 +1070,8 @@ yy_symbol_value_print (FILE *yyo,
yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp)
{ {
FILE *yyoutput = yyo; FILE *yyoutput = yyo;
YYUSE (yyoutput); YY_USE (yyoutput);
YYUSE (yylocationp); YY_USE (yylocationp);
if (!yyvaluep) if (!yyvaluep)
return; return;
# ifdef YYPRINT # ifdef YYPRINT
@@ -1703,8 +1703,8 @@ static void
yydestruct (const char *yymsg, yydestruct (const char *yymsg,
yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) yysymbol_kind_t yykind, YYSTYPE *yyvaluep, YYLTYPE *yylocationp)
{ {
YYUSE (yyvaluep); YY_USE (yyvaluep);
YYUSE (yylocationp); YY_USE (yylocationp);
if (!yymsg) if (!yymsg)
yymsg = "Deleting"; yymsg = "Deleting";
YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);

View File

@@ -334,10 +334,10 @@ exp: { ]AT_CXX_IF([[std::cerr << @$ << '\n']],
]AT_YYLEX_PROTOTYPE[ ]AT_YYLEX_PROTOTYPE[
{]AT_PURE_IF([ {]AT_PURE_IF([
YYUSE(lvalp); YY_USE (lvalp);
YYUSE(llocp);], [AT_CXX_IF([ YY_USE (llocp);], [AT_CXX_IF([
YYUSE(lvalp); YY_USE (lvalp);
YYUSE(llocp);])])[ YY_USE (llocp);])])[
return 'x'; return 'x';
} }

View File

@@ -1233,10 +1233,10 @@ list:
item: item:
'a' { $$ = $][1; } '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 // Not just 'E', otherwise we reduce when 'E' is the lookahead, and
// then the stack is emptied, defeating the point of the test. // 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; } | 'R' { ]AT_VARIANT_IF([], [$$ = YY_NULLPTR; delete $][1]; )[YYERROR; }
| 'p' { $$ = $][1; } | 'p' { $$ = $][1; }
| 's' { $$ = $][1; throw std::runtime_error ("reduction"); } | 's' { $$ = $][1; throw std::runtime_error ("reduction"); }
@@ -1395,7 +1395,7 @@ int yylex (yy::parser::semantic_type *lvalp)
// Note: this argument is unused, but named on purpose. There used to be a // Note: this argument is unused, but named on purpose. There used to be a
// bug with a macro that erroneously expanded this identifier to // bug with a macro that erroneously expanded this identifier to
// yystackp->yyval. // yystackp->yyval.
YYUSE (lvalp); YY_USE (lvalp);
return ]AT_TOKEN([ZERO])[; return ]AT_TOKEN([ZERO])[;
} }

View File

@@ -339,9 +339,8 @@ AT_PERL_CHECK([[-n -0777 -e '
|YYNTOKENS # This is actual scoped in a C++ class. |YYNTOKENS # This is actual scoped in a C++ class.
|YYPUSH_MORE(?:_DEFINED)? |YYPUSH_MORE(?:_DEFINED)?
|S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped. |S_(YY(ACCEPT|EMPTY|EOF|error|UNDEF)) # These guys are scoped.
|YYUSE
|YY_ATTRIBUTE(?:_PURE|_UNUSED)
|YY(?:_REINTERPRET)?_CAST |YY(?:_REINTERPRET)?_CAST
|YY_ATTRIBUTE(?:_PURE|_UNUSED)
|YY_CONSTEXPR |YY_CONSTEXPR
|YY_COPY |YY_COPY
|YY_CPLUSPLUS |YY_CPLUSPLUS
@@ -354,6 +353,7 @@ AT_PERL_CHECK([[-n -0777 -e '
|YY_NOTHROW |YY_NOTHROW
|YY_NULLPTR |YY_NULLPTR
|YY_RVREF |YY_RVREF
|YY_USE
|YY_\w+_INCLUDED |YY_\w+_INCLUDED
|FILE\ \*yyo # Function argument. |FILE\ \*yyo # Function argument.
|const\ yylocp # Function argument. |const\ yylocp # Function argument.

View File

@@ -584,11 +584,11 @@ m4_define([AT_YYLEX_DEFINE], [AT_LANG_DISPATCH([$0], $@)])
# AT_YYERROR_DEFINE # AT_YYERROR_DEFINE
# ------------------------- # -------------------------
# Must be called inside a AT_BISON_OPTION_PUSHDEFS/POPDEFS pair. # Must be called inside a AT_BISON_OPTION_PUSHDEFS/POPDEFS pair.
m4_define([AT_YYERROR_FORMALS], [AT_LANG_DISPATCH([$0], $@)]) m4_define([AT_YYERROR_FORMALS], [AT_LANG_DISPATCH([$0], $@)])
m4_define([AT_YYERROR_PROTOTYPE],[AT_LANG_DISPATCH([$0], $@)]) m4_define([AT_YYERROR_PROTOTYPE], [AT_LANG_DISPATCH([$0], $@)])
m4_define([AT_YYERROR_DECLARE_EXTERN], [AT_LANG_DISPATCH([$0], $@)]) m4_define([AT_YYERROR_DECLARE_EXTERN], [AT_LANG_DISPATCH([$0], $@)])
m4_define([AT_YYERROR_DECLARE], [AT_LANG_DISPATCH([$0], $@)]) m4_define([AT_YYERROR_DECLARE], [AT_LANG_DISPATCH([$0], $@)])
m4_define([AT_YYERROR_DEFINE], [AT_LANG_DISPATCH([$0], $@)]) m4_define([AT_YYERROR_DEFINE], [AT_LANG_DISPATCH([$0], $@)])
# AT_MAIN_DEFINE # AT_MAIN_DEFINE
# -------------- # --------------
@@ -671,7 +671,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]), 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]*\),* *], [ [[^,]+[^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; ++global_nerrs;
++*nerrs;]])[]AT_LOCATION_IF([[ ++*nerrs;]])[]AT_LOCATION_IF([[
LOCATION_PRINT (stderr, *yypcontext_location (ctx)); LOCATION_PRINT (stderr, *yypcontext_location (ctx));
@@ -707,11 +707,11 @@ static
]AT_YYERROR_PROTOTYPE[ ]AT_YYERROR_PROTOTYPE[
{]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), {]m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ [[^,]+[^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([[ AT_YYERROR_SEES_LOC_IF([[
LOCATION_PRINT (stderr, ]AT_LOC[); LOCATION_PRINT (stderr, ]AT_LOC[);
fprintf (stderr, ": ");]])[ fprintf (stderr, ": ");]])[
fprintf (stderr, "%s\n", msg);]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ fprintf (stderr, "%s\n", msg);]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs], [[
++global_nerrs; ++global_nerrs;
++*nerrs;]])[ ++*nerrs;]])[
}]])]) }]])])
@@ -779,7 +779,7 @@ m4_define([AT_YYERROR_DEFINE(c++)],
[[/* A C++ error reporting function. */ [[/* A C++ error reporting function. */
void void
]AT_NAMESPACE[::parser::error (]AT_LOCATION_IF([[const location_type& l, ]])[const std::string& m) ]AT_NAMESPACE[::parser::error (]AT_LOCATION_IF([[const location_type& l, ]])[const std::string& m)
{]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ {]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs], [[
++global_nerrs; ++global_nerrs;
++*nerrs;]])[ ++*nerrs;]])[
std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << '\n'; std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << '\n';
@@ -788,7 +788,7 @@ void
]AT_NAMESPACE[::parser::report_syntax_error (const context& ctx) const ]AT_NAMESPACE[::parser::report_syntax_error (const context& ctx) const
{]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]), {]AT_PARAM_IF([m4_bpatsubst(m4_defn([AT_PARSE_PARAMS]),
[[^,]+[^A-Za-z_0-9]\([A-Za-z_][A-Za-z_0-9]*\),* *], [ [[^,]+[^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; ++global_nerrs;
++*nerrs;]])[]AT_LOCATION_IF([[ ++*nerrs;]])[]AT_LOCATION_IF([[
std::cerr << ctx.location () << ": ";]])[ std::cerr << ctx.location () << ": ";]])[
@@ -1047,7 +1047,7 @@ m4_define([AT_YYERROR_DEFINE(java)],
} }
]], [[ ]], [[
public void yyerror (String m) public void yyerror (String m)
{]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs],[[ {]m4_bmatch(m4_defn([AT_PARSE_PARAMS]), [nerrs], [[
++global_nerrs; ++global_nerrs;
++*nerrs;]])[ ++*nerrs;]])[
System.err.println (m); System.err.println (m);