I guess one msvc version might not support __has_include ?

This commit is contained in:
o-micron 2020-03-09 22:50:10 +02:00
parent 20826e0665
commit 23af0d293e

View File

@ -2234,21 +2234,35 @@ using StringView = ::absl::string_view;
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
#else #else
# ifdef __has_include #ifdef __has_include
# if __has_include(<string_view>) && __cplusplus >= 201703L #if __has_include(<string_view>) && __cplusplus >= 201703L
// Otherwise for C++17 and higher use std::string_view for Matcher<> // Otherwise for C++17 and higher use std::string_view for Matcher<>
// specializations. // specializations.
# define GTEST_INTERNAL_HAS_STRING_VIEW 1 # define GTEST_INTERNAL_HAS_STRING_VIEW 1
#include <string_view> #include <string_view>
namespace testing { namespace testing {
namespace internal { namespace internal {
using StringView = ::std::string_view; using StringView = ::std::string_view;
} // namespace internal } // namespace internal
} // namespace testing } // namespace testing
// The case where absl is configured NOT to alias std::string_view is not // The case where absl is configured NOT to alias std::string_view is not
// supported. // supported.
# endif // __has_include(<string_view>) && __cplusplus >= 201703L # endif // __has_include(<string_view>) && __cplusplus >= 201703L
# endif // __has_include #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 <string_view>
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_HAS_ABSL
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_ #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_