bison-patches
[Top][All Lists]
Advanced

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

[PATCH 02/14] glr2.cc: put semantic_option into an unnamed namespace


From: Akim Demaille
Subject: [PATCH 02/14] glr2.cc: put semantic_option into an unnamed namespace
Date: Sun, 12 Sep 2021 14:07:35 +0200

If we link several glr2.cc parsers together, we get linking failures
because of duplicate symbols.

* data/skeletons/glr2.cc (semantic_option::indexIn)
(semantic_option::next): Remove the useless overloads.
---
 data/skeletons/glr2.cc | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 6d3ce093..06956d01 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -753,7 +753,10 @@ typedef int rule_num;
 
 // Forward declarations.
 class glr_state;
+namespace
+{
   class semantic_option;
+}
 class glr_stack_item;
 class glr_stack;
 
@@ -1126,6 +1129,8 @@ private:
   glr_state* yylastDeleted;
 };
 
+namespace
+{
   class semantic_option
   {
   public:
@@ -1189,11 +1194,11 @@ public:
     const glr_state* state() const;
     void setState(const glr_state* s);
 
-  const semantic_option* next () const;
+    const semantic_option* next () const YY_ATTRIBUTE_UNUSED;
     semantic_option* next ();
     void setNext (const semantic_option* s);
 
-  std::ptrdiff_t indexIn (const glr_stack_item* array) const;
+    std::ptrdiff_t indexIn (const glr_stack_item* array) const 
YY_ATTRIBUTE_UNUSED;
 
     /** True iff YYY0 and YYY1 represent identical options at the top level.
      *  That is, they represent the same rule applied to RHS symbols
@@ -1380,6 +1385,7 @@ public:
     enum { MAGIC = 0xeff1cace };
     unsigned int magic_;]])[
   };
+}
 
 /** Type of the items in the GLR stack.
  *  It can be either a glr_state or a semantic_option. The is_state_ field
-- 
2.32.0




reply via email to

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