From bd000a9d938b8b3eeabaec0b331867f66fcbf80d Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Sun, 1 Oct 2023 00:25:58 +0000 Subject: [PATCH] deps: update googletest to e47544a --- deps/googletest/include/gtest/gtest-message.h | 19 +++--- .../googletest/include/gtest/gtest-printers.h | 9 ++- .../include/gtest/internal/gtest-port.h | 64 +++++++++++-------- deps/googletest/src/gtest-filepath.cc | 2 +- deps/googletest/src/gtest.cc | 2 +- .../maintaining/maintaining-dependencies.md | 6 +- 6 files changed, 56 insertions(+), 46 deletions(-) diff --git a/deps/googletest/include/gtest/gtest-message.h b/deps/googletest/include/gtest/gtest-message.h index 59b805e4e4622c..448ac6b7ee2e09 100644 --- a/deps/googletest/include/gtest/gtest-message.h +++ b/deps/googletest/include/gtest/gtest-message.h @@ -59,7 +59,7 @@ #ifdef GTEST_HAS_ABSL #include -#include "absl/strings/internal/has_absl_stringify.h" +#include "absl/strings/has_absl_stringify.h" #include "absl/strings/str_cat.h" #endif // GTEST_HAS_ABSL @@ -121,14 +121,14 @@ class GTEST_API_ Message { // Streams a non-pointer value to this object. If building a version of // GoogleTest with ABSL, this overload is only enabled if the value does not // have an AbslStringify definition. - template ::value, // NOLINT - int>::type = 0 + , + typename std::enable_if::value, // NOLINT + int>::type = 0 #endif // GTEST_HAS_ABSL - > + > inline Message& operator<<(const T& val) { // Some libraries overload << for STL containers. These // overloads are defined in the global namespace instead of ::std. @@ -153,9 +153,8 @@ class GTEST_API_ Message { // Streams a non-pointer value with an AbslStringify definition to this // object. template ::value, // NOLINT - int>::type = 0> + typename std::enable_if::value, // NOLINT + int>::type = 0> inline Message& operator<<(const T& val) { // ::operator<< is needed here for a similar reason as with the non-Abseil // version above diff --git a/deps/googletest/include/gtest/gtest-printers.h b/deps/googletest/include/gtest/gtest-printers.h index 9ccbff7da454b5..1b12ef683c13bd 100644 --- a/deps/googletest/include/gtest/gtest-printers.h +++ b/deps/googletest/include/gtest/gtest-printers.h @@ -116,7 +116,7 @@ #include #ifdef GTEST_HAS_ABSL -#include "absl/strings/internal/has_absl_stringify.h" +#include "absl/strings/has_absl_stringify.h" #include "absl/strings/str_cat.h" #endif // GTEST_HAS_ABSL #include "gtest/internal/gtest-internal.h" @@ -292,10 +292,9 @@ struct ConvertibleToStringViewPrinter { #ifdef GTEST_HAS_ABSL struct ConvertibleToAbslStringifyPrinter { - template < - typename T, - typename = typename std::enable_if< - absl::strings_internal::HasAbslStringify::value>::type> // NOLINT + template ::value>::type> // NOLINT static void PrintValue(const T& value, ::std::ostream* os) { *os << absl::StrCat(value); } diff --git a/deps/googletest/include/gtest/internal/gtest-port.h b/deps/googletest/include/gtest/internal/gtest-port.h index 35544a08a65aae..d061a49b9f411b 100644 --- a/deps/googletest/include/gtest/internal/gtest-port.h +++ b/deps/googletest/include/gtest/internal/gtest-port.h @@ -281,6 +281,22 @@ #error C++ versions less than C++14 are not supported. #endif +// MSVC >= 19.11 (VS 2017 Update 3) supports __has_include. +#ifdef __has_include +#define GTEST_INTERNAL_HAS_INCLUDE __has_include +#else +#define GTEST_INTERNAL_HAS_INCLUDE(...) 0 +#endif + +// Detect C++ feature test macros as gracefully as possible. +// MSVC >= 19.15, Clang >= 3.4.1, and GCC >= 4.1.2 support feature test macros. +#if GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L && \ + (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE()) +#include // C++20 and later +#elif (!defined(__has_include) || GTEST_INTERNAL_HAS_INCLUDE()) +#include // Pre-C++20 +#endif + #include // for isspace, etc #include // for ptrdiff_t #include @@ -829,9 +845,9 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #ifndef GTEST_API_ #ifdef _MSC_VER -#if GTEST_LINKED_AS_SHARED_LIBRARY +#if defined(GTEST_LINKED_AS_SHARED_LIBRARY) && GTEST_LINKED_AS_SHARED_LIBRARY #define GTEST_API_ __declspec(dllimport) -#elif GTEST_CREATE_SHARED_LIBRARY +#elif defined(GTEST_CREATE_SHARED_LIBRARY) && GTEST_CREATE_SHARED_LIBRARY #define GTEST_API_ __declspec(dllexport) #endif #elif GTEST_HAVE_ATTRIBUTE_(visibility) @@ -2351,9 +2367,9 @@ using Any = ::absl::any; } // namespace internal } // namespace testing #else -#ifdef __has_include -#if __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L && \ - (!defined(_MSC_VER) || GTEST_HAS_RTTI) +#if defined(__cpp_lib_any) || (GTEST_INTERNAL_HAS_INCLUDE() && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L && \ + (!defined(_MSC_VER) || GTEST_HAS_RTTI)) // Otherwise for C++17 and higher use std::any for UniversalPrinter<> // specializations. #define GTEST_INTERNAL_HAS_ANY 1 @@ -2365,8 +2381,7 @@ using Any = ::std::any; } // namespace testing // The case where absl is configured NOT to alias std::any is not // supported. -#endif // __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L -#endif // __has_include +#endif // __cpp_lib_any #endif // GTEST_HAS_ABSL #ifndef GTEST_INTERNAL_HAS_ANY @@ -2386,8 +2401,8 @@ inline ::absl::nullopt_t Nullopt() { return ::absl::nullopt; } } // namespace internal } // namespace testing #else -#ifdef __has_include -#if __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L +#if defined(__cpp_lib_optional) || (GTEST_INTERNAL_HAS_INCLUDE() && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L) // Otherwise for C++17 and higher use std::optional for UniversalPrinter<> // specializations. #define GTEST_INTERNAL_HAS_OPTIONAL 1 @@ -2401,19 +2416,17 @@ inline ::std::nullopt_t Nullopt() { return ::std::nullopt; } } // namespace testing // The case where absl is configured NOT to alias std::optional is not // supported. -#endif // __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L -#endif // __has_include +#endif // __cpp_lib_optional #endif // GTEST_HAS_ABSL #ifndef GTEST_INTERNAL_HAS_OPTIONAL #define GTEST_INTERNAL_HAS_OPTIONAL 0 #endif -#ifdef __has_include -#if __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L +#if defined(__cpp_lib_span) || (GTEST_INTERNAL_HAS_INCLUDE() && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L) #define GTEST_INTERNAL_HAS_STD_SPAN 1 -#endif // __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 202002L -#endif // __has_include +#endif // __cpp_lib_span #ifndef GTEST_INTERNAL_HAS_STD_SPAN #define GTEST_INTERNAL_HAS_STD_SPAN 0 @@ -2430,8 +2443,9 @@ using StringView = ::absl::string_view; } // namespace internal } // namespace testing #else -#ifdef __has_include -#if __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L +#if defined(__cpp_lib_string_view) || \ + (GTEST_INTERNAL_HAS_INCLUDE() && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L) // Otherwise for C++17 and higher use std::string_view for Matcher<> // specializations. #define GTEST_INTERNAL_HAS_STRING_VIEW 1 @@ -2443,9 +2457,7 @@ using StringView = ::std::string_view; } // namespace testing // The case where absl is configured NOT to alias std::string_view is not // supported. -#endif // __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= - // 201703L -#endif // __has_include +#endif // __cpp_lib_string_view #endif // GTEST_HAS_ABSL #ifndef GTEST_INTERNAL_HAS_STRING_VIEW @@ -2464,8 +2476,8 @@ using Variant = ::absl::variant; } // namespace internal } // namespace testing #else -#ifdef __has_include -#if __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L +#if defined(__cpp_lib_variant) || (GTEST_INTERNAL_HAS_INCLUDE() && \ + GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L) // Otherwise for C++17 and higher use std::variant for UniversalPrinter<> // specializations. #define GTEST_INTERNAL_HAS_VARIANT 1 @@ -2477,16 +2489,16 @@ using Variant = ::std::variant; } // namespace internal } // namespace testing // The case where absl is configured NOT to alias std::variant is not supported. -#endif // __has_include() && GTEST_INTERNAL_CPLUSPLUS_LANG >= 201703L -#endif // __has_include +#endif // __cpp_lib_variant #endif // GTEST_HAS_ABSL #ifndef GTEST_INTERNAL_HAS_VARIANT #define GTEST_INTERNAL_HAS_VARIANT 0 #endif -#if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ - GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L +#if (defined(__cpp_constexpr) && !defined(__cpp_inline_variables)) || \ + (defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ + GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L) #define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1 #endif diff --git a/deps/googletest/src/gtest-filepath.cc b/deps/googletest/src/gtest-filepath.cc index 513e947f5703ea..902d8c7f64b7c4 100644 --- a/deps/googletest/src/gtest-filepath.cc +++ b/deps/googletest/src/gtest-filepath.cc @@ -336,7 +336,7 @@ bool FilePath::CreateDirectoriesRecursively() const { return false; } - if (pathname_.length() == 0 || this->DirectoryExists()) { + if (pathname_.empty() || this->DirectoryExists()) { return true; } diff --git a/deps/googletest/src/gtest.cc b/deps/googletest/src/gtest.cc index 62dfef664e6836..99b22ed327fd91 100644 --- a/deps/googletest/src/gtest.cc +++ b/deps/googletest/src/gtest.cc @@ -5400,7 +5400,7 @@ void UnitTest::RecordProperty(const std::string& key, int UnitTest::Run() { #ifdef GTEST_HAS_DEATH_TEST const bool in_death_test_child_process = - GTEST_FLAG_GET(internal_run_death_test).length() > 0; + !GTEST_FLAG_GET(internal_run_death_test).empty(); // Google Test implements this protocol for catching that a test // program exits before returning control to Google Test: diff --git a/doc/contributing/maintaining/maintaining-dependencies.md b/doc/contributing/maintaining/maintaining-dependencies.md index 54fd1e1d7cf341..ebd20ca02dec2f 100644 --- a/doc/contributing/maintaining/maintaining-dependencies.md +++ b/doc/contributing/maintaining/maintaining-dependencies.md @@ -15,7 +15,7 @@ This a list of all the dependencies: * [c-ares 1.19.0][] * [cjs-module-lexer 1.2.2][] * [corepack][] -* [googletest d1467f5][] +* [googletest e47544a][] * [histogram 0.11.8][] * [icu-small 73.2][] * [libuv 1.46.0][] @@ -189,7 +189,7 @@ In practical terms, Corepack will let you use Yarn and pnpm without having to install them - just like what currently happens with npm, which is shipped by Node.js by default. -### googletest d1467f5 +### googletest e47544a The [googletest](https://github.com/google/googletest) dependency is Google’s C++ testing and mocking framework. @@ -326,7 +326,7 @@ performance improvements not currently available in standard zlib. [cjs-module-lexer 1.2.2]: #cjs-module-lexer-122 [corepack]: #corepack [dependency-update-action]: ../../../.github/workflows/tools.yml -[googletest d1467f5]: #googletest-d1467f5 +[googletest e47544a]: #googletest-e47544a [histogram 0.11.8]: #histogram-0118 [icu-small 73.2]: #icu-small-732 [libuv 1.46.0]: #libuv-1460