From 23af0d293eee069f2524b6c82c86b57eb91437af Mon Sep 17 00:00:00 2001 From: o-micron Date: Mon, 9 Mar 2020 22:50:10 +0200 Subject: [PATCH] I guess one msvc version might not support __has_include ? --- .../include/gtest/internal/gtest-port.h | 44 ++++++++++++------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index 60ff4716..b4f76764 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -2234,21 +2234,35 @@ using StringView = ::absl::string_view; } // namespace internal } // namespace testing #else -# ifdef __has_include -# if __has_include() && __cplusplus >= 201703L -// Otherwise for C++17 and higher use std::string_view for Matcher<> -// specializations. -# define GTEST_INTERNAL_HAS_STRING_VIEW 1 -#include -namespace testing { -namespace internal { -using StringView = ::std::string_view; -} // namespace internal -} // namespace testing -// The case where absl is configured NOT to alias std::string_view is not -// supported. -# endif // __has_include() && __cplusplus >= 201703L -# endif // __has_include + #ifdef __has_include + #if __has_include() && __cplusplus >= 201703L + // Otherwise for C++17 and higher use std::string_view for Matcher<> + // specializations. + # define GTEST_INTERNAL_HAS_STRING_VIEW 1 + #include + namespace testing { + namespace internal { + using StringView = ::std::string_view; + } // namespace internal + } // namespace testing + // The case where absl is configured NOT to alias std::string_view is not + // supported. + # endif // __has_include() && __cplusplus >= 201703L + #else // well, what if __has_include is not supported by the compiler ? that may be the case with older msvc ? + #if __cplusplus >= 201703L + // Otherwise for C++17 and higher use std::string_view for Matcher<> + // specializations. + # define GTEST_INTERNAL_HAS_STRING_VIEW 1 + #include + namespace testing { + namespace internal { + using StringView = ::std::string_view; + } // namespace internal + } // namespace testing + // The case where absl is configured NOT to alias std::string_view is not + // supported. + #endif + # endif // __has_include #endif // GTEST_HAS_ABSL #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_