Skip to content

Commit 4190d70

Browse files
nodejs-github-bottargos
authored andcommitted
deps: update googletest to 5a37b51
PR-URL: #51657 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 7a166a2 commit 4190d70

File tree

4 files changed

+97
-72
lines changed

4 files changed

+97
-72
lines changed

deps/googletest/include/gtest/gtest-param-test.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ internal::ParamConverterGenerator<T> ConvertGenerator(
469469
::testing::internal::CodeLocation(__FILE__, __LINE__)); \
470470
return 0; \
471471
} \
472-
static int gtest_registering_dummy_ GTEST_ATTRIBUTE_UNUSED_; \
472+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static int gtest_registering_dummy_; \
473473
}; \
474474
int GTEST_TEST_CLASS_NAME_(test_suite_name, \
475475
test_name)::gtest_registering_dummy_ = \
@@ -514,8 +514,8 @@ internal::ParamConverterGenerator<T> ConvertGenerator(
514514
::testing::internal::DefaultParamName<test_suite_name::ParamType>, \
515515
DUMMY_PARAM_))))(info); \
516516
} \
517-
static int gtest_##prefix##test_suite_name##_dummy_ \
518-
GTEST_ATTRIBUTE_UNUSED_ = \
517+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static int \
518+
gtest_##prefix##test_suite_name##_dummy_ = \
519519
::testing::UnitTest::GetInstance() \
520520
->parameterized_test_registry() \
521521
.GetTestSuitePatternHolder<test_suite_name>( \

deps/googletest/include/gtest/gtest-typed-test.h

+65-61
Original file line numberDiff line numberDiff line change
@@ -194,33 +194,34 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
194194
typedef ::testing::internal::NameGeneratorSelector<__VA_ARGS__>::type \
195195
GTEST_NAME_GENERATOR_(CaseName)
196196

197-
#define TYPED_TEST(CaseName, TestName) \
198-
static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \
199-
"test-name must not be empty"); \
200-
template <typename gtest_TypeParam_> \
201-
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
202-
: public CaseName<gtest_TypeParam_> { \
203-
private: \
204-
typedef CaseName<gtest_TypeParam_> TestFixture; \
205-
typedef gtest_TypeParam_ TypeParam; \
206-
void TestBody() override; \
207-
}; \
208-
static bool gtest_##CaseName##_##TestName##_registered_ \
209-
GTEST_ATTRIBUTE_UNUSED_ = ::testing::internal::TypeParameterizedTest< \
210-
CaseName, \
211-
::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_(CaseName, \
212-
TestName)>, \
213-
GTEST_TYPE_PARAMS_( \
214-
CaseName)>::Register("", \
215-
::testing::internal::CodeLocation( \
216-
__FILE__, __LINE__), \
217-
GTEST_STRINGIFY_(CaseName), \
218-
GTEST_STRINGIFY_(TestName), 0, \
219-
::testing::internal::GenerateNames< \
220-
GTEST_NAME_GENERATOR_(CaseName), \
221-
GTEST_TYPE_PARAMS_(CaseName)>()); \
222-
template <typename gtest_TypeParam_> \
223-
void GTEST_TEST_CLASS_NAME_(CaseName, \
197+
#define TYPED_TEST(CaseName, TestName) \
198+
static_assert(sizeof(GTEST_STRINGIFY_(TestName)) > 1, \
199+
"test-name must not be empty"); \
200+
template <typename gtest_TypeParam_> \
201+
class GTEST_TEST_CLASS_NAME_(CaseName, TestName) \
202+
: public CaseName<gtest_TypeParam_> { \
203+
private: \
204+
typedef CaseName<gtest_TypeParam_> TestFixture; \
205+
typedef gtest_TypeParam_ TypeParam; \
206+
void TestBody() override; \
207+
}; \
208+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \
209+
gtest_##CaseName##_##TestName##_registered_ = \
210+
::testing::internal::TypeParameterizedTest< \
211+
CaseName, \
212+
::testing::internal::TemplateSel<GTEST_TEST_CLASS_NAME_( \
213+
CaseName, TestName)>, \
214+
GTEST_TYPE_PARAMS_( \
215+
CaseName)>::Register("", \
216+
::testing::internal::CodeLocation( \
217+
__FILE__, __LINE__), \
218+
GTEST_STRINGIFY_(CaseName), \
219+
GTEST_STRINGIFY_(TestName), 0, \
220+
::testing::internal::GenerateNames< \
221+
GTEST_NAME_GENERATOR_(CaseName), \
222+
GTEST_TYPE_PARAMS_(CaseName)>()); \
223+
template <typename gtest_TypeParam_> \
224+
void GTEST_TEST_CLASS_NAME_(CaseName, \
224225
TestName)<gtest_TypeParam_>::TestBody()
225226

226227
// Legacy API is deprecated but still available
@@ -267,31 +268,32 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
267268
TYPED_TEST_SUITE_P
268269
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
269270

270-
#define TYPED_TEST_P(SuiteName, TestName) \
271-
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
272-
template <typename gtest_TypeParam_> \
273-
class TestName : public SuiteName<gtest_TypeParam_> { \
274-
private: \
275-
typedef SuiteName<gtest_TypeParam_> TestFixture; \
276-
typedef gtest_TypeParam_ TypeParam; \
277-
void TestBody() override; \
278-
}; \
279-
static bool gtest_##TestName##_defined_ GTEST_ATTRIBUTE_UNUSED_ = \
280-
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
281-
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
282-
GTEST_STRINGIFY_(TestName)); \
283-
} \
284-
template <typename gtest_TypeParam_> \
285-
void GTEST_SUITE_NAMESPACE_( \
271+
#define TYPED_TEST_P(SuiteName, TestName) \
272+
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
273+
template <typename gtest_TypeParam_> \
274+
class TestName : public SuiteName<gtest_TypeParam_> { \
275+
private: \
276+
typedef SuiteName<gtest_TypeParam_> TestFixture; \
277+
typedef gtest_TypeParam_ TypeParam; \
278+
void TestBody() override; \
279+
}; \
280+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \
281+
gtest_##TestName##_defined_ = \
282+
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).AddTestName( \
283+
__FILE__, __LINE__, GTEST_STRINGIFY_(SuiteName), \
284+
GTEST_STRINGIFY_(TestName)); \
285+
} \
286+
template <typename gtest_TypeParam_> \
287+
void GTEST_SUITE_NAMESPACE_( \
286288
SuiteName)::TestName<gtest_TypeParam_>::TestBody()
287289

288290
// Note: this won't work correctly if the trailing arguments are macros.
289291
#define REGISTER_TYPED_TEST_SUITE_P(SuiteName, ...) \
290292
namespace GTEST_SUITE_NAMESPACE_(SuiteName) { \
291293
typedef ::testing::internal::Templates<__VA_ARGS__> gtest_AllTests_; \
292294
} \
293-
static const char* const GTEST_REGISTERED_TEST_NAMES_( \
294-
SuiteName) GTEST_ATTRIBUTE_UNUSED_ = \
295+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static const char* const \
296+
GTEST_REGISTERED_TEST_NAMES_(SuiteName) = \
295297
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName).VerifyRegisteredTestNames( \
296298
GTEST_STRINGIFY_(SuiteName), __FILE__, __LINE__, #__VA_ARGS__)
297299

@@ -303,22 +305,24 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
303305
REGISTER_TYPED_TEST_SUITE_P
304306
#endif // GTEST_REMOVE_LEGACY_TEST_CASEAPI_
305307

306-
#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
307-
static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \
308-
"test-suit-prefix must not be empty"); \
309-
static bool gtest_##Prefix##_##SuiteName GTEST_ATTRIBUTE_UNUSED_ = \
310-
::testing::internal::TypeParameterizedTestSuite< \
311-
SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
312-
::testing::internal::GenerateTypeList<Types>::type>:: \
313-
Register(GTEST_STRINGIFY_(Prefix), \
314-
::testing::internal::CodeLocation(__FILE__, __LINE__), \
315-
&GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
316-
GTEST_STRINGIFY_(SuiteName), \
317-
GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
318-
::testing::internal::GenerateNames< \
319-
::testing::internal::NameGeneratorSelector< \
320-
__VA_ARGS__>::type, \
321-
::testing::internal::GenerateTypeList<Types>::type>())
308+
#define INSTANTIATE_TYPED_TEST_SUITE_P(Prefix, SuiteName, Types, ...) \
309+
static_assert(sizeof(GTEST_STRINGIFY_(Prefix)) > 1, \
310+
"test-suit-prefix must not be empty"); \
311+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static bool \
312+
gtest_##Prefix##_##SuiteName = \
313+
::testing::internal::TypeParameterizedTestSuite< \
314+
SuiteName, GTEST_SUITE_NAMESPACE_(SuiteName)::gtest_AllTests_, \
315+
::testing::internal::GenerateTypeList<Types>::type>:: \
316+
Register( \
317+
GTEST_STRINGIFY_(Prefix), \
318+
::testing::internal::CodeLocation(__FILE__, __LINE__), \
319+
&GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName), \
320+
GTEST_STRINGIFY_(SuiteName), \
321+
GTEST_REGISTERED_TEST_NAMES_(SuiteName), \
322+
::testing::internal::GenerateNames< \
323+
::testing::internal::NameGeneratorSelector< \
324+
__VA_ARGS__>::type, \
325+
::testing::internal::GenerateTypeList<Types>::type>())
322326

323327
// Legacy API is deprecated but still available
324328
#ifndef GTEST_REMOVE_LEGACY_TEST_CASEAPI_

deps/googletest/include/gtest/internal/gtest-internal.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -1501,7 +1501,8 @@ class NeverThrown {
15011501
\
15021502
private: \
15031503
void TestBody() override; \
1504-
static ::testing::TestInfo* const test_info_ GTEST_ATTRIBUTE_UNUSED_; \
1504+
GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED static ::testing::TestInfo* const \
1505+
test_info_; \
15051506
}; \
15061507
\
15071508
::testing::TestInfo* const GTEST_TEST_CLASS_NAME_(test_suite_name, \

deps/googletest/include/gtest/internal/gtest-port.h

+27-7
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,6 @@
194194
//
195195
// Macros for basic C++ coding:
196196
// GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning.
197-
// GTEST_ATTRIBUTE_UNUSED_ - declares that a class' instances or a
198-
// variable don't have to be used.
199197
// GTEST_MUST_USE_RESULT_ - declares that a function's result must be used.
200198
// GTEST_INTENTIONAL_CONST_COND_PUSH_ - start code section where MSVC C4127 is
201199
// suppressed (constant conditional).
@@ -749,6 +747,20 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
749747
#define GTEST_HAVE_ATTRIBUTE_(x) 0
750748
#endif
751749

750+
// GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE
751+
//
752+
// A function-like feature checking macro that accepts C++11 style attributes.
753+
// It's a wrapper around `__has_cpp_attribute`, defined by ISO C++ SD-6
754+
// (https://en.cppreference.com/w/cpp/experimental/feature_test). If we don't
755+
// find `__has_cpp_attribute`, will evaluate to 0.
756+
#if defined(__has_cpp_attribute)
757+
// NOTE: requiring __cplusplus above should not be necessary, but
758+
// works around https://bugs.llvm.org/show_bug.cgi?id=23435.
759+
#define GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
760+
#else
761+
#define GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(x) 0
762+
#endif
763+
752764
// GTEST_HAVE_FEATURE_
753765
//
754766
// A function-like feature checking macro that is a wrapper around
@@ -760,14 +772,22 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
760772
#endif
761773

762774
// Use this annotation after a variable or parameter declaration to tell the
763-
// compiler the variable/parameter does not have to be used.
775+
// compiler the variable/parameter may be used.
764776
// Example:
765777
//
766-
// GTEST_ATTRIBUTE_UNUSED_ int foo = bar();
767-
#if GTEST_HAVE_ATTRIBUTE_(unused)
768-
#define GTEST_ATTRIBUTE_UNUSED_ __attribute__((unused))
778+
// GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED int foo = bar();
779+
//
780+
// This can be removed once we only support only C++17 or newer and
781+
// [[maybe_unused]] is available on all supported platforms.
782+
#if GTEST_INTERNAL_HAVE_CPP_ATTRIBUTE(maybe_unused)
783+
#define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED [[maybe_unused]]
784+
#elif GTEST_HAVE_ATTRIBUTE_(unused)
785+
// This is inferior to [[maybe_unused]] as it can produce a
786+
// -Wused-but-marked-unused warning on optionally used symbols, but it is all we
787+
// have.
788+
#define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED __attribute__((__unused__))
769789
#else
770-
#define GTEST_ATTRIBUTE_UNUSED_
790+
#define GTEST_INTERNAL_ATTRIBUTE_MAYBE_UNUSED
771791
#endif
772792

773793
// Use this annotation before a function that takes a printf format string.

0 commit comments

Comments
 (0)