Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion googlemock/include/gmock/internal/gmock-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@
static_assert(true, "no-op to require trailing semicolon")
#define GMOCK_DEFINE_string_(name, default_val, doc) \
namespace testing { \
GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val); \
GTEST_API_ GMOCK_NODESTRUCTOR \
::std::string GMOCK_FLAG(name) = (default_val); \
} \
static_assert(true, "no-op to require trailing semicolon")

Expand Down
4 changes: 2 additions & 2 deletions googletest/include/gtest/gtest-typed-test.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ INSTANTIATE_TYPED_TEST_SUITE_P(My, FooTest, MyTypes);
// The variables defined in the type-parameterized test macros are
// static as typically these macros are used in a .h file that can be
// #included in multiple translation units linked together.
#define TYPED_TEST_SUITE_P(SuiteName) \
static ::testing::internal::TypedTestSuitePState \
#define TYPED_TEST_SUITE_P(SuiteName) \
GTEST_NODESTRUCTOR static ::testing::internal::TypedTestSuitePState \
GTEST_TYPED_TEST_SUITE_P_STATE_(SuiteName)

// Legacy API is deprecated but still available
Expand Down
6 changes: 6 additions & 0 deletions googletest/include/gtest/internal/gtest-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -1514,4 +1514,10 @@ class NeverThrown {
test_suite_name, test_name)>); \
void GTEST_TEST_CLASS_NAME_(test_suite_name, test_name)::TestBody()

#ifdef __clang__
#define GTEST_NODESTRUCTOR [[clang::no_destroy]]
#else
#define GTEST_NODESTRUCTOR
#endif

#endif // GOOGLETEST_INCLUDE_GTEST_INTERNAL_GTEST_INTERNAL_H_
9 changes: 8 additions & 1 deletion googletest/include/gtest/internal/gtest-port.h
Original file line number Diff line number Diff line change
Expand Up @@ -2229,6 +2229,12 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
#define GTEST_FLAG(name) FLAGS_gtest_##name
#endif // !defined(GTEST_FLAG)

#ifdef __clang__
#define GMOCK_NODESTRUCTOR [[clang::no_destroy]]
#else
#define GMOCK_NODESTRUCTOR
#endif

// Pick a command line flags implementation.
#ifdef GTEST_INTERNAL_HAS_ABSL_FLAGS

Expand Down Expand Up @@ -2271,7 +2277,8 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
static_assert(true, "no-op to require trailing semicolon")
#define GTEST_DEFINE_string_(name, default_val, doc) \
namespace testing { \
GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val); \
GTEST_API_ GTEST_NODESTRUCTOR \
::std::string GTEST_FLAG(name) = (default_val); \
} \
static_assert(true, "no-op to require trailing semicolon")

Expand Down