[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/14] glr2.cc: don't pass %parse-param to destroy
From: |
Akim Demaille |
Subject: |
[PATCH 14/14] glr2.cc: don't pass %parse-param to destroy |
Date: |
Sun, 12 Sep 2021 14:07:47 +0200 |
I regret that %destructor and %printer give access to the %parse-param
in lalr1.cc, since that prevents them from being implemented as a
simple destructor and operator<<. Let's not repeat the mistake in
glr2.cc. In addition, fixes a name conflict we have currently in
tests 566 568 570 657:
calc.cc:1395:85: error: declaration shadows a field of 'calc::parser'
[-Werror,-Wshadow]
void glr_state::destroy (char const* yymsg, calc::parser& yyparser,
semantic_value *result, int *count, int *nerrs)
^
calc.hh:441:21: note: previous declaration is here
semantic_value *result;
^
With this commit, the whole test suite passes for glr2.cc.
* data/skeletons/glr2.cc (glr_state::destroy): Don't take the user
arguments.
---
data/skeletons/glr2.cc | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index a639bfe0..907abb2a 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -941,7 +941,7 @@ namespace ]b4_namespace_ref[
}
void
- destroy (char const *yymsg, ]b4_namespace_ref[::]b4_parser_class[&
yyparser]b4_user_formals[);
+ destroy (char const *yymsg, ]b4_namespace_ref[::]b4_parser_class[&
yyparser);
/* DEBUGGING ONLY */
#if ]b4_api_PREFIX[DEBUG
@@ -1630,7 +1630,7 @@ void semantic_option::setNext (const semantic_option* s)
yynext = s ? asItem(this) - asItem(s) : 0;
}
-void glr_state::destroy (char const* yymsg,
]b4_namespace_ref[::]b4_parser_class[& yyparser]b4_user_formals[)
+void glr_state::destroy (char const* yymsg,
]b4_namespace_ref[::]b4_parser_class[& yyparser)
{]b4_parse_assert_if([[
check_ ();]])[
if (yyresolved)
@@ -1653,7 +1653,7 @@ void glr_state::destroy (char const* yymsg,
]b4_namespace_ref[::]b4_parser_class
glr_state *yyrh = yyoption.state ();
for (int yyn = yyrhsLength (yyoption.yyrule); yyn > 0; yyn -= 1)
{
- yyrh->destroy (yymsg, yyparser]b4_user_args[);
+ yyrh->destroy (yymsg, yyparser);
yyrh = yyrh->pred();
}
}
@@ -2457,7 +2457,7 @@ b4_dollar_popdef])[]dnl
}]b4_locations_if([[
yyerror_range[1].getState().yyloc = yys->yyloc;]])[
if (yys->pred() != YY_NULLPTR)
- yys->destroy ("Error: popping", yyparser]b4_user_args[);
+ yys->destroy ("Error: popping", yyparser);
yystateStack.setFirstTop(yys->pred());
yystateStack.pop_back();
}
@@ -2836,7 +2836,7 @@ b4_dollar_popdef])[]dnl
glr_state* state = topState(k);]b4_locations_if([[
yyerror_range[1].getState().yyloc = state->yyloc;]])[
if (state->pred() != YY_NULLPTR)
- state->destroy ("Cleanup: popping", yyparser]b4_user_args[);
+ state->destroy ("Cleanup: popping", yyparser);
yystateStack.setTopAt(k, state->pred());
yystateStack.pop_back();
}
@@ -2996,7 +2996,7 @@ b4_dollar_popdef])[]dnl
if (yyflag != yyok)
{
for (glr_state *yys = yyoptState; yynrhs > 0; yys = yys->pred(),
yynrhs -= 1)
- yys->destroy ("Cleanup: popping", yyparser]b4_user_args[);
+ yys->destroy ("Cleanup: popping", yyparser);
return yyflag;
}
--
2.32.0
- [PATCH 04/14] glr2.cc: put create_state_set_index in unnamed namespace, (continued)
- [PATCH 04/14] glr2.cc: put create_state_set_index in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 05/14] glr2.cc: move glr_stack and glr_state into the parser class, Akim Demaille, 2021/09/12
- [PATCH 06/14] glr2.cc: style: clarify control flow, Akim Demaille, 2021/09/12
- [PATCH 07/14] glr2.cc: move state_stack into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 08/14] glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 09/14] glr2.cc: prefer using, and remove useless type aliases, Akim Demaille, 2021/09/12
- [PATCH 10/14] glr2.cc: use only symbol_kind_type, not yysymbol_kind_t, Akim Demaille, 2021/09/12
- [PATCH 11/14] glr2.cc: move strong_index_alias into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 12/14] glr2.cc: check linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 13/14] glr2.cc: kill trailing white spaces, Akim Demaille, 2021/09/12
- [PATCH 14/14] glr2.cc: don't pass %parse-param to destroy,
Akim Demaille <=
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Tom Shields, 2021/09/12
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Hans Åberg, 2021/09/13
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Thomas Shields, 2021/09/13
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Hans Åberg, 2021/09/13