mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 12:17:11 +01:00 
			
		
		
		
	Unify handling of __has_include checks
This commit is contained in:
		| @@ -201,49 +201,39 @@ | ||||
| #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER | ||||
| #endif | ||||
|  | ||||
| //////////////////////////////////////////////////////////////////////////////// | ||||
| // Check if string_view is available and usable | ||||
| // The check is split apart to work around v140 (VS2015) preprocessor issue... | ||||
| // Various stdlib support checks that require __has_include | ||||
| #if defined(__has_include) | ||||
| #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #    define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW | ||||
| #endif | ||||
| #endif | ||||
|   // Check if string_view is available and usable | ||||
|   #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER) | ||||
|   #    define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW | ||||
|   #endif | ||||
|  | ||||
| //////////////////////////////////////////////////////////////////////////////// | ||||
| // Check if optional is available and usable | ||||
| #if defined(__has_include) | ||||
| #  if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #    define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL | ||||
| #  endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #endif // __has_include | ||||
|   // Check if optional is available and usable | ||||
|   #  if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) | ||||
|   #    define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL | ||||
|   #  endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) | ||||
|  | ||||
| //////////////////////////////////////////////////////////////////////////////// | ||||
| // Check if byte is available and usable | ||||
| #if defined(__has_include) | ||||
| #  if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #    define CATCH_INTERNAL_CONFIG_CPP17_BYTE | ||||
| #  endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #endif // __has_include | ||||
|   // Check if byte is available and usable | ||||
|   #  if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) | ||||
|   #    define CATCH_INTERNAL_CONFIG_CPP17_BYTE | ||||
|   #  endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) | ||||
|  | ||||
| //////////////////////////////////////////////////////////////////////////////// | ||||
| // Check if variant is available and usable | ||||
| #if defined(__has_include) | ||||
| #  if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #    if defined(__clang__) && (__clang_major__ < 8) | ||||
|        // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 | ||||
|        // fix should be in clang 8, workaround in libstdc++ 8.2 | ||||
| #      include <ciso646> | ||||
| #      if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) | ||||
| #        define CATCH_CONFIG_NO_CPP17_VARIANT | ||||
| #      else | ||||
| #        define CATCH_INTERNAL_CONFIG_CPP17_VARIANT | ||||
| #      endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) | ||||
| #    else | ||||
| #      define CATCH_INTERNAL_CONFIG_CPP17_VARIANT | ||||
| #    endif // defined(__clang__) && (__clang_major__ < 8) | ||||
| #  endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #endif // __has_include | ||||
|   // Check if variant is available and usable | ||||
|   #  if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) | ||||
|   #    if defined(__clang__) && (__clang_major__ < 8) | ||||
|          // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 | ||||
|          // fix should be in clang 8, workaround in libstdc++ 8.2 | ||||
|   #      include <ciso646> | ||||
|   #      if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) | ||||
|   #        define CATCH_CONFIG_NO_CPP17_VARIANT | ||||
|   #      else | ||||
|   #        define CATCH_INTERNAL_CONFIG_CPP17_VARIANT | ||||
|   #      endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) | ||||
|   #    else | ||||
|   #      define CATCH_INTERNAL_CONFIG_CPP17_VARIANT | ||||
|   #    endif // defined(__clang__) && (__clang_major__ < 8) | ||||
|   #  endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) | ||||
| #endif // defined(__has_include) | ||||
|  | ||||
|  | ||||
| #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský