[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/14] glr2.cc: move strong_index_alias into the unnamed namespac
From: |
Akim Demaille |
Subject: |
[PATCH 11/14] glr2.cc: move strong_index_alias into the unnamed namespace |
Date: |
Sun, 12 Sep 2021 14:07:44 +0200 |
* data/skeletons/glr2.cc: here.
---
data/skeletons/glr2.cc | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index 49382474..70755e99 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -435,16 +435,19 @@ m4_define([b4_shared_declarations],
]b4_header_if([[#include "@basename(]b4_spec_header_file[@)"]],
[b4_shared_declarations([cc])])[
+namespace
+{
/* Default (constant) value used for initialization for null
right-hand sides. Unlike the standard yacc.c template, here we set
the default value of $$ to a zeroed-out value. Since the default
value is undefined, this behavior is technically correct. */
-static ]b4_namespace_ref[::]b4_parser_class[::value_type yyval_default;
+ ]b4_namespace_ref[::]b4_parser_class[::value_type yyval_default;
+}
]b4_user_post_prologue[
-]b4_percent_code_get[]dnl
+]b4_percent_code_get[
-[#include <cstdio>
+#include <cstdio>
#include <cstdlib>
#ifndef YY_
@@ -586,7 +589,7 @@ namespace
{
]b4_conflicting_rules[
};
-}
+} // namespace
/* Error token number */
@@ -676,6 +679,8 @@ namespace
# define YYSTACKEXPANDABLE 1
#endif
+namespace
+{
template <typename Parameter>
class strong_index_alias
{
@@ -752,7 +757,7 @@ private:
// WARNING: 0-initialized.
std::ptrdiff_t value_;
-};
+ }; // class strong_index_alias
template<typename T>
const std::ptrdiff_t strong_index_alias<T>::INVALID_INDEX =
@@ -760,13 +765,10 @@ const std::ptrdiff_t strong_index_alias<T>::INVALID_INDEX
=
using state_set_index = strong_index_alias<struct glr_state_set_tag>;
-namespace
-{
state_set_index create_state_set_index (std::ptrdiff_t value)
{
return state_set_index::create (value);
}
-}
/** State numbers, as in LALR(1) machine */
using state_num = int;
@@ -774,8 +776,6 @@ using state_num = int;
/** Rule numbers, as in LALR(1) machine */
using rule_num = int;
-namespace
-{
using parser_type = ]b4_namespace_ref[::]b4_parser_class[;
using glr_state = parser_type::glr_state;
using symbol_kind = parser_type::symbol_kind;
@@ -786,7 +786,7 @@ namespace
// Forward declarations.
class glr_stack_item;
class semantic_option;
-}
+} // namespace
namespace
{
--
2.32.0
- [PATCH 01/14] glr2.cc: don't publish YY_EXCEPTIONS, (continued)
- [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, 2021/09/12
- [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 <=
- [PATCH 12/14] glr2.cc: check linking conflicts, Akim Demaille, 2021/09/12
- [PATCH 13/14] glr2.cc: kill trailing white spaces, Akim Demaille, 2021/09/12
- [PATCH 14/14] glr2.cc: don't pass %parse-param to destroy, Akim Demaille, 2021/09/12
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Tom Shields, 2021/09/12
- Re: [PATCH 00/14] glr2.cc: fix linking conflicts, Hans Åberg, 2021/09/13