summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@google.com>2023-03-03 23:56:41 (GMT)
committerCopybara-Service <copybara-worker@google.com>2023-03-06 15:15:17 (GMT)
commita08c03c5f52802c50a541d7283be31a4c3177807 (patch)
tree7fbe9df109a133220d2286b6dfa941e1a50ea498
parent23142843f7c875907a6ed7985174a6e346e82c3d (diff)
downloadgoogletest-a08c03c5f52802c50a541d7283be31a4c3177807.zip
googletest-a08c03c5f52802c50a541d7283be31a4c3177807.tar.gz
googletest-a08c03c5f52802c50a541d7283be31a4c3177807.tar.bz2
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
-rw-r--r--googletest/include/gtest/internal/gtest-port.h23
1 files changed, 20 insertions, 3 deletions
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index f2b0bbf..ba5e9bc 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -202,16 +202,17 @@
// is suppressed.
// GTEST_INTERNAL_HAS_ANY - for enabling UniversalPrinter<std::any> or
// UniversalPrinter<absl::any> specializations.
+// Always defined to 0 or 1.
// GTEST_INTERNAL_HAS_OPTIONAL - for enabling UniversalPrinter<std::optional>
// or
// UniversalPrinter<absl::optional>
-// specializations.
+// specializations. Always defined to 0 or 1.
// GTEST_INTERNAL_HAS_STRING_VIEW - for enabling Matcher<std::string_view> or
// Matcher<absl::string_view>
-// specializations.
+// specializations. Always defined to 0 or 1.
// GTEST_INTERNAL_HAS_VARIANT - for enabling UniversalPrinter<std::variant> or
// UniversalPrinter<absl::variant>
-// specializations.
+// specializations. Always defined to 0 or 1.
//
// Synchronization:
// Mutex, MutexLock, ThreadLocal, GetThreadCount()
@@ -2389,6 +2390,10 @@ using Any = ::std::any;
#endif // __has_include
#endif // GTEST_HAS_ABSL
+#ifndef GTEST_INTERNAL_HAS_ANY
+#define GTEST_INTERNAL_HAS_ANY 0
+#endif
+
#if GTEST_HAS_ABSL
// Always use absl::optional for UniversalPrinter<> specializations if
// googletest is built with absl support.
@@ -2421,6 +2426,10 @@ inline ::std::nullopt_t Nullopt() { return ::std::nullopt; }
#endif // __has_include
#endif // GTEST_HAS_ABSL
+#ifndef GTEST_INTERNAL_HAS_OPTIONAL
+#define GTEST_INTERNAL_HAS_OPTIONAL 0
+#endif
+
#if GTEST_HAS_ABSL
// Always use absl::string_view for Matcher<> specializations if googletest
// is built with absl support.
@@ -2449,6 +2458,10 @@ using StringView = ::std::string_view;
#endif // __has_include
#endif // GTEST_HAS_ABSL
+#ifndef GTEST_INTERNAL_HAS_STRING_VIEW
+#define GTEST_INTERNAL_HAS_STRING_VIEW 0
+#endif
+
#if GTEST_HAS_ABSL
// Always use absl::variant for UniversalPrinter<> specializations if googletest
// is built with absl support.
@@ -2478,6 +2491,10 @@ using Variant = ::std::variant<T...>;
#endif // __has_include
#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
#define GTEST_INTERNAL_NEED_REDUNDANT_CONSTEXPR_DECL 1