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

Compiler capabilities clean-up

- renamed CATCH_SFINAE -> CATCH_CONFIG_SFINAE
- moved variadic macros detection into catch_compiler_capabilities.h
Commit
4dd3f68dd930fdb9f26c1776118e663908864931
Author
Phil Nash ·
Parents
dd52044374ef

Files · Download .tar.gz

Changes

 include/catch.hpp                                     |  9 +--------
 include/internal/catch_capture.hpp                    |  2 ++
 include/internal/catch_compiler_capabilities.h        | 19 +++++++++++++------
 include/internal/catch_section.hpp                    |  1 +
 include/internal/catch_sfinae.hpp                     |  4 ++--
 include/internal/catch_test_registry.hpp              |  1 +
 include/internal/catch_tostring.hpp                   |  4 ++--
 projects/SelfTest/VariadicMacrosTests.cpp             |  1 -
 .../CatchSelfTest.xcodeproj/project.pbxproj           |  6 +++---
 9 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/include/catch.hpp b/include/catch.hpp
index 9e8c2a71..6e57a9da 100644
--- a/include/catch.hpp
+++ b/include/catch.hpp
@@ -17,14 +17,6 @@
 #pragma clang diagnostic ignored "-Wpadded"
 #endif
 
-// Use variadic macros if the compiler supports them
-#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
-    ( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
-    ( defined __GNUC__ && __GNUC__ >= 3 ) || \
-    ( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
-    #define CATCH_CONFIG_VARIADIC_MACROS
-#endif
-
 #include "internal/catch_notimplemented_exception.h"
 #include "internal/catch_context.h"
 #include "internal/catch_test_registry.hpp"
@@ -34,6 +26,7 @@
 #include "internal/catch_interfaces_exception.h"
 #include "internal/catch_approx.hpp"
 #include "internal/catch_matchers.hpp"
+#include "internal/catch_compiler_capabilities.h"
 
 // These files are included here so the single_include script doesn't put them
 // in the conditionally compiled sections
diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp
index 575f1931..81eb4a0d 100644
--- a/include/internal/catch_capture.hpp
+++ b/include/internal/catch_capture.hpp
@@ -16,6 +16,8 @@
 #include "catch_context.h"
 #include "catch_common.h"
 #include "catch_interfaces_registry_hub.h"
+#include "internal/catch_compiler_capabilities.h"
+
 #include <ostream>
 
 namespace Catch {
diff --git a/include/internal/catch_compiler_capabilities.h b/include/internal/catch_compiler_capabilities.h
index e2486a3d..6f08a624 100644
--- a/include/internal/catch_compiler_capabilities.h
+++ b/include/internal/catch_compiler_capabilities.h
@@ -15,7 +15,7 @@
 #ifdef __BORLANDC__
 
 #if (__BORLANDC__ > 0x582 )
-//#define CATCH_SFINAE // Not confirmed
+//#define CATCH_CONFIG_SFINAE // Not confirmed
 #endif
 
 #endif // __BORLANDC__
@@ -25,7 +25,7 @@
 #ifdef __EDG_VERSION__
 
 #if (__EDG_VERSION__ > 238 )
-//#define CATCH_SFINAE // Not confirmed
+//#define CATCH_CONFIG_SFINAE // Not confirmed
 #endif
 
 #endif // __EDG_VERSION__
@@ -35,7 +35,7 @@
 #ifdef __DMC__
 
 #if (__DMC__ > 0x840 )
-//#define CATCH_SFINAE // Not confirmed
+//#define CATCH_CONFIG_SFINAE // Not confirmed
 #endif
 
 #endif // __DMC__
@@ -47,12 +47,12 @@
 #if __GNUC__ < 3
 
 #if (__GNUC_MINOR__ >= 96 )
-#define CATCH_SFINAE
+#define CATCH_CONFIG_SFINAE
 #endif
 
 #elif __GNUC__ >= 3
 
-// #define CATCH_SFINAE // Taking this out completely for now
+// #define CATCH_CONFIG_SFINAE // Taking this out completely for now
 
 #endif // __GNUC__ < 3
 
@@ -64,11 +64,18 @@
 #ifdef _MSC_VER
 
 #if (_MSC_VER >= 1310 ) // (VC++ 7.0+)
-//#define CATCH_SFINAE // Not confirmed
+//#define CATCH_CONFIG_SFINAE // Not confirmed
 #endif
 
 #endif // _MSC_VER
 
+// Use variadic macros if the compiler supports them
+#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
+    ( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
+    ( defined __GNUC__ && __GNUC__ >= 3 ) || \
+    ( !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L )
+    #define CATCH_CONFIG_VARIADIC_MACROS
+#endif
 
 #endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
 
diff --git a/include/internal/catch_section.hpp b/include/internal/catch_section.hpp
index 5c7e53aa..67bced6b 100644
--- a/include/internal/catch_section.hpp
+++ b/include/internal/catch_section.hpp
@@ -10,6 +10,7 @@
 
 #include "catch_capture.hpp"
 #include "catch_totals.hpp"
+#include "catch_compiler_capabilities.h"
 
 #include <string>
 
diff --git a/include/internal/catch_sfinae.hpp b/include/internal/catch_sfinae.hpp
index ccb6dba9..bf8749fd 100644
--- a/include/internal/catch_sfinae.hpp
+++ b/include/internal/catch_sfinae.hpp
@@ -24,7 +24,7 @@ namespace Catch {
         char sizer[2];
     };
 
-#ifdef CATCH_SFINAE
+#ifdef CATCH_CONFIG_SFINAE
 
     template<bool> struct NotABooleanExpression;
 
@@ -36,7 +36,7 @@ namespace Catch {
     template<> struct SizedIf<sizeof(TrueType)> : TrueType {};
     template<> struct SizedIf<sizeof(FalseType)> : FalseType {};
 
-#endif // CATCH_SFINAE
+#endif // CATCH_CONFIG_SFINAE
     
 } // end namespace Catch
 
diff --git a/include/internal/catch_test_registry.hpp b/include/internal/catch_test_registry.hpp
index 108de42a..ff0e3e87 100644
--- a/include/internal/catch_test_registry.hpp
+++ b/include/internal/catch_test_registry.hpp
@@ -10,6 +10,7 @@
 
 #include "catch_common.h"
 #include "catch_interfaces_testcase.h"
+#include "internal/catch_compiler_capabilities.h"
 
 namespace Catch {
     
diff --git a/include/internal/catch_tostring.hpp b/include/internal/catch_tostring.hpp
index e751816e..5d3bf39a 100644
--- a/include/internal/catch_tostring.hpp
+++ b/include/internal/catch_tostring.hpp
@@ -24,8 +24,8 @@ namespace Detail {
 
 // SFINAE is currently disabled by default for all compilers.
 // If the non SFINAE version of IsStreamInsertable is ambiguous for you
-// and your compiler supports SFINAE, try #defining CATCH_SFINAE
-#ifdef CATCH_SFINAE
+// and your compiler supports SFINAE, try #defining CATCH_CONFIG_SFINAE
+#ifdef CATCH_CONFIG_SFINAE
 
     template<typename T>
     class IsStreamInsertableHelper {
diff --git a/projects/SelfTest/VariadicMacrosTests.cpp b/projects/SelfTest/VariadicMacrosTests.cpp
index 7155f801..f51980c1 100644
--- a/projects/SelfTest/VariadicMacrosTests.cpp
+++ b/projects/SelfTest/VariadicMacrosTests.cpp
@@ -6,7 +6,6 @@
  *  file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  */
 
-//#define CATCH_CONFIG_VARIADIC_MACROS
 #include "catch.hpp"
 
 TEST_CASE()
diff --git a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
index 37f2f351..5993fa47 100644
--- a/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
+++ b/projects/XCode4/CatchSelfTest/CatchSelfTest.xcodeproj/project.pbxproj
@@ -60,8 +60,8 @@
 		266ECD73170F3C620030D735 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = BDDTests.cpp; path = ../../../SelfTest/BDDTests.cpp; sourceTree = "<group>"; };
 		266ECD8C1713614B0030D735 /* catch_legacy_reporter_adapter.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_legacy_reporter_adapter.hpp; sourceTree = "<group>"; };
 		266ECD8D1713614B0030D735 /* catch_legacy_reporter_adapter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_legacy_reporter_adapter.h; sourceTree = "<group>"; };
-		26759472171C72A400A84BD1 /* catch_sfinae.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_sfinae.hpp; sourceTree = "<group>"; };
-		26759473171C74C200A84BD1 /* catch_compiler_capabilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_compiler_capabilities.h; sourceTree = "<group>"; };
+		26759472171C72A400A84BD1 /* catch_sfinae.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_sfinae.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
+		26759473171C74C200A84BD1 /* catch_compiler_capabilities.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_compiler_capabilities.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		26847E5B16BBAB790043B9C1 /* catch_message.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_message.h; sourceTree = "<group>"; };
 		26847E5C16BBACB60043B9C1 /* catch_message.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_message.hpp; sourceTree = "<group>"; };
 		26847E5D16BBADB40043B9C1 /* catch_message.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_message.cpp; path = ../../../SelfTest/SurrogateCpps/catch_message.cpp; sourceTree = "<group>"; };
@@ -139,7 +139,7 @@
 		4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_generators.h; sourceTree = "<group>"; };
 		4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_assertionresult.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_expressionresult_builder.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
-		4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_tostring.hpp; sourceTree = "<group>"; };
+		4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_tostring.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
 		4A9D84B315599AC900FBB209 /* catch_expressionresult_builder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_expressionresult_builder.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
 		4AA7B8B4165428BA003155F6 /* catch_version.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = catch_version.hpp; path = ../../../../include/internal/catch_version.hpp; sourceTree = "<group>"; };
 		4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_console_colour_impl.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };