bison-patches
[Top][All Lists]
Advanced

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

[PATCH 09/16] c++: make valid to print the empty symbol


From: Akim Demaille
Subject: [PATCH 09/16] c++: make valid to print the empty symbol
Date: Sun, 26 Apr 2020 16:40:44 +0200

* data/skeletons/lalr1.cc (yy_print_): here.
---
 data/skeletons/lalr1.cc | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/data/skeletons/lalr1.cc b/data/skeletons/lalr1.cc
index a7c5d684..99c64331 100644
--- a/data/skeletons/lalr1.cc
+++ b/data/skeletons/lalr1.cc
@@ -795,23 +795,21 @@ m4_if(b4_prefix, [yy], [],
 #if ]b4_api_PREFIX[DEBUG
   template <typename Base>
   void
-  ]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;
     YYUSE (yyoutput);
-    symbol_kind_type yykind = yysym.kind ();
-#if defined __GNUC__ && ! defined __clang__ && ! defined __ICC && __GNUC__ * 
100 + __GNUC_MINOR__ <= 408
-    // Avoid a (spurious) G++ 4.8 warning about "array subscript is
-    // below array bounds".
     if (yysym.empty ())
-      std::abort ();
-#endif
-    yyo << (yykind < YYNTOKENS ? "token" : "nterm")
-        << ' ' << symbol_name (yykind) << " ("]b4_locations_if([
-        << yysym.location << ": "])[;
-    ]b4_symbol_actions([printer])[
-    yyo << ')';
+      yyo << "empty symbol";
+    else
+      {
+        symbol_kind_type yykind = yysym.kind ();
+        yyo << (yykind < YYNTOKENS ? "token" : "nterm")
+            << ' ' << symbol_name (yykind) << " ("]b4_locations_if([
+            << yysym.location << ": "])[;
+        ]b4_symbol_actions([printer])[
+        yyo << ')';
+      }
   }
 #endif
 
-- 
2.26.2




reply via email to

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