mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +01:00 
			
		
		
		
	Fix CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTION interaction with feature macro
This commit is contained in:
		@@ -127,8 +127,8 @@ Catch's selection, by defining either `CATCH_CONFIG_CPP11_TO_STRING` or
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
## C++17 toggles
 | 
					## C++17 toggles
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS  // Use std::uncaught_exceptions instead of std::uncaught_exception
 | 
					    CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS  // Override std::uncaught_exceptions (instead of std::uncaught_exception) support detection
 | 
				
			||||||
    CATCH_CONFIG_CPP17_STRING_VIEW          // Override std::string_view support detection(Catch provides a StringMaker specialization by default)
 | 
					    CATCH_CONFIG_CPP17_STRING_VIEW          // Override std::string_view support detection (Catch provides a StringMaker specialization by default)
 | 
				
			||||||
    CATCH_CONFIG_CPP17_VARIANT              // Override std::variant support detection (checked by CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER)
 | 
					    CATCH_CONFIG_CPP17_VARIANT              // Override std::variant support detection (checked by CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER)
 | 
				
			||||||
    CATCH_CONFIG_CPP17_OPTIONAL             // Override std::optional support detection (checked by CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER)
 | 
					    CATCH_CONFIG_CPP17_OPTIONAL             // Override std::optional support detection (checked by CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER)
 | 
				
			||||||
    CATCH_CONFIG_CPP17_BYTE                 // Override std::byte support detection (Catch provides a StringMaker specialization by default)
 | 
					    CATCH_CONFIG_CPP17_BYTE                 // Override std::byte support detection (Catch provides a StringMaker specialization by default)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,10 +39,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(__cpp_lib_uncaught_exceptions)
 | 
					 | 
				
			||||||
#  define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// We have to avoid both ICC and Clang, because they try to mask themselves
 | 
					// We have to avoid both ICC and Clang, because they try to mask themselves
 | 
				
			||||||
// as gcc, and we want only GCC in this block
 | 
					// as gcc, and we want only GCC in this block
 | 
				
			||||||
#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
 | 
					#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC)
 | 
				
			||||||
@@ -161,10 +157,6 @@
 | 
				
			|||||||
#  define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
 | 
					#  define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION __pragma( warning(push) )
 | 
				
			||||||
#  define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  __pragma( warning(pop) )
 | 
					#  define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  __pragma( warning(pop) )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#  if _MSC_VER >= 1900 // Visual Studio 2015 or newer
 | 
					 | 
				
			||||||
#    define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
 | 
					 | 
				
			||||||
#  endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Universal Windows platform does not support SEH
 | 
					// Universal Windows platform does not support SEH
 | 
				
			||||||
// Or console colours (or console at all...)
 | 
					// Or console colours (or console at all...)
 | 
				
			||||||
#  if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
 | 
					#  if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
 | 
				
			||||||
@@ -292,10 +284,6 @@
 | 
				
			|||||||
#  define CATCH_CONFIG_CPP17_OPTIONAL
 | 
					#  define CATCH_CONFIG_CPP17_OPTIONAL
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
 | 
					 | 
				
			||||||
#  define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
 | 
					#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)
 | 
				
			||||||
#  define CATCH_CONFIG_CPP17_STRING_VIEW
 | 
					#  define CATCH_CONFIG_CPP17_STRING_VIEW
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
namespace Catch {
 | 
					namespace Catch {
 | 
				
			||||||
    bool uncaught_exceptions() {
 | 
					    bool uncaught_exceptions() {
 | 
				
			||||||
#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)
 | 
					#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) || (defined(__cpp_lib_uncaught_exceptions) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS))
 | 
				
			||||||
        return std::uncaught_exceptions() > 0;
 | 
					        return std::uncaught_exceptions() > 0;
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
        return std::uncaught_exception();
 | 
					        return std::uncaught_exception();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user