Always specify definitions for internal macros

These macros should only be used within googletest, so changing them will not
affect external users.

This allows compiling with -Wundef (#3267).

PiperOrigin-RevId: 513943800
Change-Id: I697b1005c29b0d5af06f583f202d86db48b567b9
This commit is contained in:
Tom Hughes 2023-03-03 15:56:41 -08:00 committed by Copybara-Service
parent 23142843f7
commit a08c03c5f5

View File

@ -202,16 +202,17 @@
// is suppressed. // is suppressed.
// GTEST_INTERNAL_HAS_ANY - for enabling UniversalPrinter<std::any> or // GTEST_INTERNAL_HAS_ANY - for enabling UniversalPrinter<std::any> or
// UniversalPrinter<absl::any> specializations. // UniversalPrinter<absl::any> specializations.
// Always defined to 0 or 1.
// GTEST_INTERNAL_HAS_OPTIONAL - for enabling UniversalPrinter<std::optional> // GTEST_INTERNAL_HAS_OPTIONAL - for enabling UniversalPrinter<std::optional>
// or // or
// UniversalPrinter<absl::optional> // UniversalPrinter<absl::optional>
// specializations. // specializations. Always defined to 0 or 1.
// GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or // GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or
// Matcher<absl::string_view> // Matcher<absl::string_view>
// specializations. // specializations. Always defined to 0 or 1.
// GTEST_INTERNAL_HAS_VARIANT - for enabling UniversalPrinter<std::variant> or // GTEST_INTERNAL_HAS_VARIANT - for enabling UniversalPrinter<std::variant> or
// UniversalPrinter<absl::variant> // UniversalPrinter<absl::variant>
// specializations. // specializations. Always defined to 0 or 1.
// //
// Synchronization: // Synchronization:
// Mutex, MutexLock, ThreadLocal, GetThreadCount() // Mutex, MutexLock, ThreadLocal, GetThreadCount()
@ -2389,6 +2390,10 @@ using Any = ::std::any;
#endif // __has_include #endif // __has_include
#endif // GTEST_HAS_ABSL #endif // GTEST_HAS_ABSL
#ifndef GTEST_INTERNAL_HAS_ANY
#define GTEST_INTERNAL_HAS_ANY 0
#endif
#if GTEST_HAS_ABSL #if GTEST_HAS_ABSL
// Always use absl::optional for UniversalPrinter<> specializations if // Always use absl::optional for UniversalPrinter<> specializations if
// googletest is built with absl support. // googletest is built with absl support.
@ -2421,6 +2426,10 @@ inline ::std::nullopt_t Nullopt() { return ::std::nullopt; }
#endif // __has_include #endif // __has_include
#endif // GTEST_HAS_ABSL #endif // GTEST_HAS_ABSL
#ifndef GTEST_INTERNAL_HAS_OPTIONAL
#define GTEST_INTERNAL_HAS_OPTIONAL 0
#endif
#if GTEST_HAS_ABSL #if GTEST_HAS_ABSL
// Always use absl::string_view for Matcher<> specializations if googletest // Always use absl::string_view for Matcher<> specializations if googletest
// is built with absl support. // is built with absl support.
@ -2449,6 +2458,10 @@ using StringView = ::std::string_view;
#endif // __has_include #endif // __has_include
#endif // GTEST_HAS_ABSL #endif // GTEST_HAS_ABSL
#ifndef GTEST_INTERNAL_HAS_STRING_VIEW
#define GTEST_INTERNAL_HAS_STRING_VIEW 0
#endif
#if GTEST_HAS_ABSL #if GTEST_HAS_ABSL
// Always use absl::variant for UniversalPrinter<> specializations if googletest // Always use absl::variant for UniversalPrinter<> specializations if googletest
// is built with absl support. // is built with absl support.
@ -2478,6 +2491,10 @@ using Variant = ::std::variant<T...>;
#endif // __has_include #endif // __has_include
#endif // GTEST_HAS_ABSL #endif // GTEST_HAS_ABSL
#ifndef GTEST_INTERNAL_HAS_VARIANT
#define GTEST_INTERNAL_HAS_VARIANT 0
#endif
#if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \ #if defined(GTEST_INTERNAL_CPLUSPLUS_LANG) && \
GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L GTEST_INTERNAL_CPLUSPLUS_LANG < 201703L
#define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1 #define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1