[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/9] glr2.cc: move StrongIndexAlias into the namespace
From: |
Akim Demaille |
Subject: |
[PATCH 4/9] glr2.cc: move StrongIndexAlias into the namespace |
Date: |
Sat, 12 Sep 2020 16:51:50 +0200 |
From: Valentin Tolmer <valentin.tolmer@gmail.com>
* data/skeletons/glr2.cc: here.
---
TODO | 4 ----
data/skeletons/glr2.cc | 28 ++++++++++++++--------------
2 files changed, 14 insertions(+), 18 deletions(-)
diff --git a/TODO b/TODO
index 56c0b80e..98849e7a 100644
--- a/TODO
+++ b/TODO
@@ -162,10 +162,6 @@ Line -1 and -3 should mention CATEGORIE, not CATEGORY.
*** glr.c
Get rid of scaffolding in glr.c.
-*** namespaces in glr2.cc
-StrongIndexAlias should be in the parser's namespace. Possibly even an
-inner class.
-
*** Coding style
Move to our coding conventions. In particular names such as yy_glr_stack,
not yyGLRStack.
diff --git a/data/skeletons/glr2.cc b/data/skeletons/glr2.cc
index a5af6f4f..a0a17122 100644
--- a/data/skeletons/glr2.cc
+++ b/data/skeletons/glr2.cc
@@ -145,6 +145,19 @@ b4_percent_code_get([[requires]])[
]b4_cast_define[
]b4_null_define[
+// Whether we are compiled with exception support.
+#ifndef YY_EXCEPTIONS
+# if defined __GNUC__ && !defined __EXCEPTIONS
+# define YY_EXCEPTIONS 0
+# else
+# define YY_EXCEPTIONS 1
+# endif
+#endif
+
+]b4_YYDEBUG_define[
+
+]b4_namespace_open[
+
template <typename Parameter>
class StrongIndexAlias
{
@@ -215,19 +228,6 @@ template<typename T>
const std::ptrdiff_t StrongIndexAlias<T>::INVALID_INDEX =
std::numeric_limits<std::ptrdiff_t>::max();
-// Whether we are compiled with exception support.
-#ifndef YY_EXCEPTIONS
-# if defined __GNUC__ && !defined __EXCEPTIONS
-# define YY_EXCEPTIONS 0
-# else
-# define YY_EXCEPTIONS 1
-# endif
-#endif
-
-]b4_YYDEBUG_define[
-
-]b4_namespace_open[
-
]b4_bison_locations_if([m4_ifndef([b4_location_file],
[b4_location_define])])[
@@ -791,7 +791,7 @@ struct yySemanticOption;
struct yyGLRStackItem;
struct yyGLRStack;
-typedef StrongIndexAlias<struct yyGLRStateSetTag> yyStateSetIndex;
+typedef ]b4_namespace_ref[::StrongIndexAlias<struct yyGLRStateSetTag>
yyStateSetIndex;
yyStateSetIndex yycreateStateSetIndex(std::ptrdiff_t value) {
return yyStateSetIndex::create(value);
--
2.28.0
- [PATCH 0/9] glr2.cc: warnings and style, Akim Demaille, 2020/09/12
- [PATCH 1/9] glr2.cc: add copy constructor to yyGLRStackItem, Akim Demaille, 2020/09/12
- [PATCH 2/9] glr2.cc: remove C-style casts, Akim Demaille, 2020/09/12
- [PATCH 3/9] glr2.cc: remove usage of PTRDIFF_MAX, Akim Demaille, 2020/09/12
- [PATCH 4/9] glr2.cc: move StrongIndexAlias into the namespace,
Akim Demaille <=
- [PATCH 5/9] glr2.cc: coding style changes, Akim Demaille, 2020/09/12
- [PATCH 6/9] glr2.cc: fix GCC10 warning, Akim Demaille, 2020/09/12
- [PATCH 7/9] glr2.cc: formatting changes, Akim Demaille, 2020/09/12
- [PATCH 8/9] glr2.cc: get rid of the C indirection for yy_symbol_print, Akim Demaille, 2020/09/12
- [PATCH 9/9] glr2.cc: address warnings with G++ 4.8, Akim Demaille, 2020/09/12