[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
tests: c++: don't fuse prefix and namespace
From: |
Akim Demaille |
Subject: |
tests: c++: don't fuse prefix and namespace |
Date: |
Sat, 6 Oct 2018 17:28:09 +0200 |
I was writing tests using only api.namespace, and got errors because the
generated yylex had its prefix changed. This is only related to the testsuite,
but made me realize that we still propagate the api.prefix as api.namespace
without warnings, and I think we should not.
This should be addressed in 3.2.
commit 1a0b3bf83bf32569724c3e43ca698e13b7bc6136
Author: Akim Demaille <address@hidden>
Date: Sat Oct 6 16:50:30 2018 +0200
tests: c++: don't fuse prefix and namespace
They are not the same concept. It appears that we still consider that
api.prefix is the default for api.namespace. We should stop that.
* tests/local.at (AT_BISON_OPTION_PUSHDEFS, AT_BISON_OPTION_POPDEFS):
Separate namespace and prefix.
Adjust dependencies.
diff --git a/tests/local.at b/tests/local.at
index cc4abc6d..3bcb8357 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -184,8 +184,15 @@ m4_pushdef([AT_PURE_IF],
[$2])])
m4_pushdef([AT_PUSH_IF],
[m4_bmatch([$3], [%define api.push-pull \(both\|pull\)], [$1], [$2])])
-# AT_NAME_PREFIX: also consider api.namespace.
+# AT_NAME_PREFIX.
m4_pushdef([AT_NAME_PREFIX],
+[m4_bmatch([$3], [\(%define api\.\|prefix\|%name-prefix\) .*],
+ [m4_bregexp([$3],
+ [\(%define api\.prefix\|%name-prefix\) [\{\"]\([^\"\}]*\)[\"\}]],
+ [\2])],
+ [yy])])
+# AT_NAMESPACE: also consider api.prefix. FIXME: Stop that confusion.
+m4_pushdef([AT_NAMESPACE],
[m4_bmatch([$3], [\(%define api\.\(namespace\|prefix\)\|%name-prefix\) .*],
[m4_bregexp([$3],
[\(%define api\.\(namespace\|prefix\)\|%name-prefix\)
[\{\"]\([^\"\}]*\)[\"\}]],
@@ -235,10 +242,10 @@ m4_pushdef([AT_PURE_LEX_IF],
[AT_SKEL_CC_IF([$1], [$2])])])
m4_pushdef([AT_YYSTYPE],
-[AT_SKEL_CC_IF([AT_NAME_PREFIX[::parser::semantic_type]],
+[AT_SKEL_CC_IF([AT_NAMESPACE[::parser::semantic_type]],
[AT_API_PREFIX[STYPE]])])
m4_pushdef([AT_YYLTYPE],
-[AT_SKEL_CC_IF([AT_NAME_PREFIX[::parser::location_type]],
+[AT_SKEL_CC_IF([AT_NAMESPACE[::parser::location_type]],
[AT_API_PREFIX[LTYPE]])])
@@ -299,6 +306,7 @@ m4_popdef([AT_API_prefix])
m4_popdef([AT_VARIANT_IF])
m4_popdef([AT_TOKEN_PREFIX])
m4_popdef([AT_TOKEN_CTOR_IF])
+m4_popdef([AT_NAMESPACE])
m4_popdef([AT_NAME_PREFIX])
m4_popdef([AT_LOCATION_TYPE_IF])
m4_popdef([AT_LOCATION_IF])
@@ -543,7 +551,7 @@ m4_define([AT_YYERROR_DECLARE_EXTERN(c++)], [])
m4_define([AT_YYERROR_DEFINE(c++)],
[[/* A C++ error reporting function. */
void
-]AT_NAME_PREFIX[::parser::error (]AT_LOCATION_IF([[const location_type& l,
]])[const std::string& m)
+]AT_NAMESPACE[::parser::error (]AT_LOCATION_IF([[const location_type& l,
]])[const std::string& m)
{
std::cerr << ]AT_LOCATION_IF([l << ": " << ])[m << '\n';
}]])
@@ -555,7 +563,7 @@ m4_define([AT_MAIN_DEFINE(c++)],
int
main (int argc, char const* argv[])
{
- ]AT_NAME_PREFIX[::parser p;]AT_DEBUG_IF([[
+ ]AT_NAMESPACE[::parser p;]AT_DEBUG_IF([[
if (getenv("YYDEBUG")
|| (argc == 2
&& (!strcmp (argv[1], "-d") || !strcmp (argv[1], "--debug"))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- tests: c++: don't fuse prefix and namespace,
Akim Demaille <=