glr2.cc: fix warning with GCC 4.7 and 4.8

231. conflicts.at:1096: testing Syntax error in consistent error state: glr2.cc ...
    tests/conflicts.at:1096: $CXX $CXXFLAGS $CPPFLAGS  $LDFLAGS -o input input.cc $LIBS
    input.cc: In function 'int yyparse(yy::parser&)':
    input.cc:3147:41: error: 'yyarg' may be used uninitialized in this function [-Werror=maybe-uninitialized]
         return yytnamerr_ (yytname_[yysymbol]);
                                             ^
    input.cc:2058:34: note: 'yyarg' was declared here
         yy::parser::symbol_kind_type yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
                                      ^

* data/skeletons/glr2.cc (yyreportSyntaxError): Initialize yyarg.
This commit is contained in:
Akim Demaille
2020-09-14 19:42:25 +02:00
parent 243fa94ce2
commit 795a59aba4

View File

@@ -1812,8 +1812,9 @@ class state_stack {
#define YYFILL(N) yystateStack.yyfill (yyvsp, &yylow, (N), yynormal) #define YYFILL(N) yystateStack.yyfill (yyvsp, &yylow, (N), yynormal)
#define yystackp this #define yystackp this
class glr_stack { class glr_stack
public: {
public:
glr_stack(size_t yysize, ]b4_namespace_ref[::]b4_parser_class[& yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[) glr_stack(size_t yysize, ]b4_namespace_ref[::]b4_parser_class[& yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[)
: yyerrState(0) : yyerrState(0)
@@ -1911,7 +1912,8 @@ class glr_stack {
: YYTRANSLATE (yychar); : YYTRANSLATE (yychar);
enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
/* Arguments of yyformat. */ /* Arguments of yyformat. */
]b4_namespace_ref::b4_parser_class[::symbol_kind_type yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; ]b4_namespace_ref::b4_parser_class[::symbol_kind_type yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]
= { ]b4_namespace_ref::b4_parser_class::b4_symbol(-2, kind)[ };
/* Number of reported tokens (one for the "unexpected", one per /* Number of reported tokens (one for the "unexpected", one per
"expected"). */ "expected"). */
int yycount = 0; int yycount = 0;