[PATCH 4/4] c++: variants: minor simplification

Akim Demaille <[email protected]>
Newsgroups gmane.comp.parsers.bison.patches
Message-ID <[email protected]>
Do as Valentin Tolmer did in glr2.cc.

* data/skeletons/variant.hh: The union does not need to be named.
---
 data/skeletons/variant.hh | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/data/skeletons/variant.hh b/data/skeletons/variant.hh
index c37bdd42..a4f7e38a 100644
--- a/data/skeletons/variant.hh
+++ b/data/skeletons/variant.hh
@@ -102,7 +102,7 @@ m4_define([b4_value_type_declare],
 
     /// Empty construction.
     semantic_type () YY_NOEXCEPT
-      : yybuffer_ ()]b4_parse_assert_if([
+      : yyraw_ ()]b4_parse_assert_if([
       , yytypeid_ (YY_NULLPTR)])[
     {}
 
@@ -277,7 +277,7 @@ m4_define([b4_value_type_declare],
     T*
     yyas_ () YY_NOEXCEPT
     {
-      void *yyp = yybuffer_.yyraw;
+      void *yyp = yyraw_;
       return static_cast<T*> (yyp);
      }
 
@@ -286,7 +286,7 @@ m4_define([b4_value_type_declare],
     const T*
     yyas_ () const YY_NOEXCEPT
     {
-      const void *yyp = yybuffer_.yyraw;
+      const void *yyp = yyraw_;
       return static_cast<const T*> (yyp);
      }
 
@@ -301,10 +301,10 @@ m4_define([b4_value_type_declare],
     union
     {
       /// Strongest alignment constraints.
-      long double yyalign_me;
+      long double yyalign_me_;
       /// A buffer large enough to store any of the semantic values.
-      char yyraw[size];
-    } yybuffer_;]b4_parse_assert_if([
+      char yyraw_[size];
+    };]b4_parse_assert_if([
 
     /// Whether the content is built: if defined, the name of the stored type.
     const std::type_info *yytypeid_;])[
-- 
2.28.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.