bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 2/5] glr2.cc: fix warning with GCC 4.7 and 4.8


From: Akim Demaille
Subject: [PATCH 2/5] glr2.cc: fix warning with GCC 4.7 and 4.8
Date: Thu, 17 Sep 2020 19:40:55 +0200

    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.
---
 data/skeletons/glr2.cc | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 0852fa16..55dc3164 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -1812,8 +1812,9 @@ class state_stack {
 #define YYFILL(N) yystateStack.yyfill (yyvsp, &yylow, (N), yynormal)
 
 #define yystackp this
-class glr_stack {
- public:
+class glr_stack
+{
+public:
 
   glr_stack(size_t yysize, ]b4_namespace_ref[::]b4_parser_class[& 
yyparser_yyarg]m4_ifset([b4_parse_param], [, b4_parse_param_decl])[)
     : yyerrState(0)
@@ -1911,7 +1912,8 @@ class glr_stack {
       : YYTRANSLATE (yychar);
     enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
     /* 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
        "expected").  */
     int yycount = 0;
-- 
2.28.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]