Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Tweaked Cliche macros/ names

Commit
c98a97cf90eaf95fedd540f29a0ba8015c925eae
Author
Phil Nash ·
Parents
4554155e3dea

Files · Download .tar.gz

Changes

 include/internal/catch_clara.h     |  4 ++--
 include/internal/clara.h           | 24 ++++++++++++++----------
 projects/SelfTest/CmdLineTests.cpp |  2 +-
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/include/internal/catch_clara.h b/include/internal/catch_clara.h
index 636be471..0f9dfa62 100644
--- a/include/internal/catch_clara.h
+++ b/include/internal/catch_clara.h
@@ -9,8 +9,8 @@
 #ifndef TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
 #define TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
 
-#define CLICHE_CLARA_EMBEDDED_NAMESPACE Catch
+#define CLICHE_CLARA_OUTER_NAMESPACE Catch
 #include "clara.h"
-#undef CLICHE_CLARA_EMBEDDED_NAMESPACE
+#undef CLICHE_CLARA_OUTER_NAMESPACE
 
 #endif // TWOBLUECUBES_CATCH_CLARA_H_INCLUDED
diff --git a/include/internal/clara.h b/include/internal/clara.h
index 494b959a..7ae8c334 100644
--- a/include/internal/clara.h
+++ b/include/internal/clara.h
@@ -5,20 +5,24 @@
  *  Distributed under the Boost Software License, Version 1.0. (See accompanying
  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  */
-#ifndef CLICHE_CLARA_EMBEDDED_NAMESPACE
-#ifdef TWOBLUECUBES_CLARA_H_INCLUDED
-#define TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED
-#else
-#define TWOBLUECUBES_CLARA_H_INCLUDED
-#endif
-#endif
 
+// Only use header guard if we are not using an outer namespace
+#ifndef CLICHE_CLARA_OUTER_NAMESPACE
+# ifdef TWOBLUECUBES_CLARA_H_INCLUDED
+#  ifndef TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED
+#   define TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED
+#  endif
+# else
+#  define TWOBLUECUBES_CLARA_H_INCLUDED
+# endif
+#endif
 #ifndef TWOBLUECUBES_CLARA_H_ALREADY_INCLUDED
 
 #include "catch_text.h" // This will get moved out too
 
-#ifdef CLICHE_CLARA_EMBEDDED_NAMESPACE
-namespace CLICHE_CLARA_EMBEDDED_NAMESPACE {
+// Use optional outer namespace
+#ifdef CLICHE_CLARA_OUTER_NAMESPACE
+namespace CLICHE_CLARA_OUTER_NAMESPACE {
 #endif
 
 namespace Clara {
@@ -593,7 +597,7 @@ namespace Clara {
 
 } // end namespace Clara
 
-#ifdef CLICHE_CLARA_EMBEDDED_NAMESPACE
+#ifdef CLICHE_CLARA_OUTER_NAMESPACE
 } // end embedded namespace
 #endif
 
diff --git a/projects/SelfTest/CmdLineTests.cpp b/projects/SelfTest/CmdLineTests.cpp
index 3eb54d2f..8d003fed 100644
--- a/projects/SelfTest/CmdLineTests.cpp
+++ b/projects/SelfTest/CmdLineTests.cpp
@@ -9,7 +9,7 @@
 #pragma clang diagnostic ignored "-Wpadded"
 #endif
 
-#include "internal/clara.h"
+#include "internal/clara.h" // This will does not declare Clara within the Catch namespace
 
 #include "catch.hpp"