Unify handling of __has_include checks

This commit is contained in:
Martin Hořeňovský 2019-09-06 13:38:58 +02:00
parent 1189a73be2
commit 6e8d769775
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A

View File

@ -201,49 +201,39 @@
#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER #define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER
#endif #endif
//////////////////////////////////////////////////////////////////////////////// // Various stdlib support checks that require __has_include
// Check if string_view is available and usable
// The check is split apart to work around v140 (VS2015) preprocessor issue...
#if defined(__has_include) #if defined(__has_include)
#if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER) // Check if string_view is available and usable
# define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)
#endif # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW
#endif #endif
//////////////////////////////////////////////////////////////////////////////// // Check if optional is available and usable
// Check if optional is available and usable # if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)
#if defined(__has_include) # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL
# if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER) # endif // __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 byte is available and usable
// Check if byte is available and usable # if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)
#if defined(__has_include) # define CATCH_INTERNAL_CONFIG_CPP17_BYTE
# if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER) # endif // __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 variant is available and usable
// Check if variant is available and usable # if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
#if defined(__has_include) # if defined(__clang__) && (__clang_major__ < 8)
# 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 // 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 // fix should be in clang 8, workaround in libstdc++ 8.2
# include <ciso646> # include <ciso646>
# if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) # if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
# define CATCH_CONFIG_NO_CPP17_VARIANT # define CATCH_CONFIG_NO_CPP17_VARIANT
# else # else
# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
# endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) # endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)
# else # else
# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT
# endif // defined(__clang__) && (__clang_major__ < 8) # endif // defined(__clang__) && (__clang_major__ < 8)
# endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER) # endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)
#endif // __has_include #endif // defined(__has_include)
#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER)