do not use inline namespace from checked C++ bindings
authorSven Verdoolaege <sven.verdoolaege@gmail.com>
Tue, 12 Jun 2018 20:43:20 +0000 (12 22:43 +0200)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Mon, 30 Jul 2018 21:10:33 +0000 (30 23:10 +0200)
The next commit introduces conversion functions between
objects in the checked C++ bindings and objects
in the unchecked C++ bindings.
These conversion functions need to reference types
in both bindings at the same time, meaning that
the checked namespace cannot be inlined.

This means that a user who does not want to explicitly
mention the "checked" namespace (implying that only
the checked bindings are used), will have to do
the "inlining" herself.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
cpp/cpp-checked.h.pre
interface/cpp.cc
isl_test_cpp-checked.cc

index 38f7d38..0e1e95f 100644 (file)
@@ -3,7 +3,7 @@
 #include <string>
 
 namespace isl {
-inline namespace checked {
+namespace checked {
 
 #define ISLPP_STRINGIZE_(X) #X
 #define ISLPP_STRINGIZE(X) ISLPP_STRINGIZE_(X)
index 0672fa3..dc6d5c7 100644 (file)
@@ -80,7 +80,7 @@ static std::string to_string(long l)
  * implementations.
  *
  * If checked C++ bindings are being generated,
- * then wrap them in an inline namespace to avoid conflicts
+ * then wrap them in a namespace to avoid conflicts
  * with the default C++ bindings (with automatic checks using exceptions).
  */
 void cpp_generator::generate()
@@ -90,7 +90,7 @@ void cpp_generator::generate()
        osprintf(os, "\n");
        osprintf(os, "namespace isl {\n\n");
        if (checked)
-               osprintf(os, "inline namespace checked {\n\n");
+               osprintf(os, "namespace checked {\n\n");
 
        print_forward_declarations(os);
        osprintf(os, "\n");
index 848dd17..d9b02de 100644 (file)
@@ -14,6 +14,8 @@
 #include <isl/options.h>
 #include <isl/cpp-checked.h>
 
+namespace isl { using namespace checked; }
+
 static void assert_impl(bool condition, const char *file, int line,
        const char *message)
 {