[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
- [PATCH 00/14] glr2.cc: fix linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 01/14] glr2.cc: don't publish YY_EXCEPTIONS, Akim Demaille, 2021/09/12
- [PATCH 02/14] glr2.cc: put semantic_option into an unnamed namespace,
Akim Demaille <=
- [PATCH 03/14] glr2.cc: prefer unnamed namespace to 'static', Akim Demaille, 2021/09/12
- [PATCH 04/14] glr2.cc: put create_state_set_index in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 05/14] glr2.cc: move glr_stack and glr_state into the parser class, Akim Demaille, 2021/09/12
- [PATCH 06/14] glr2.cc: style: clarify control flow, Akim Demaille, 2021/09/12
- [PATCH 07/14] glr2.cc: move state_stack into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 08/14] glr2.cc: put glr_state_set and glr_stack_item in unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 09/14] glr2.cc: prefer using, and remove useless type aliases, Akim Demaille, 2021/09/12
- [PATCH 10/14] glr2.cc: use only symbol_kind_type, not yysymbol_kind_t, Akim Demaille, 2021/09/12
- [PATCH 11/14] glr2.cc: move strong_index_alias into the unnamed namespace, Akim Demaille, 2021/09/12
- [PATCH 12/14] glr2.cc: check linking conflicts, Akim Demaille, 2021/09/12