From b479e7a3c161d7087113a05f8cb034b870313a55 Mon Sep 17 00:00:00 2001 From: Daniel Cheng Date: Mon, 11 Mar 2024 10:31:09 -0700 Subject: [PATCH] Guard Abseil flags usage in googlemock with GTEST_NO_ABSL_FLAGS. googletest avoids using the Abseil flag library, so googlemock should do the same for consistency. PiperOrigin-RevId: 614713968 Change-Id: I0925804b8644ddc6fd3ad07a320d94829b11bb8e --- googlemock/include/gmock/internal/gmock-port.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/googlemock/include/gmock/internal/gmock-port.h b/googlemock/include/gmock/internal/gmock-port.h index 55ddfb6c..e9d9e32a 100644 --- a/googlemock/include/gmock/internal/gmock-port.h +++ b/googlemock/include/gmock/internal/gmock-port.h @@ -56,7 +56,7 @@ #include "gmock/internal/custom/gmock-port.h" #include "gtest/internal/gtest-port.h" -#ifdef GTEST_HAS_ABSL +#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS) #include "absl/flags/declare.h" #include "absl/flags/flag.h" #endif @@ -73,7 +73,7 @@ #define GMOCK_FLAG(name) FLAGS_gmock_##name // Pick a command line flags implementation. -#ifdef GTEST_HAS_ABSL +#if defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS) // Macros for defining flags. #define GMOCK_DEFINE_bool_(name, default_val, doc) \ @@ -95,7 +95,7 @@ #define GMOCK_FLAG_SET(name, value) \ (void)(::absl::SetFlag(&GMOCK_FLAG(name), value)) -#else // GTEST_HAS_ABSL +#else // defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS) // Macros for defining flags. #define GMOCK_DEFINE_bool_(name, default_val, doc) \ @@ -134,6 +134,6 @@ #define GMOCK_FLAG_GET(name) ::testing::GMOCK_FLAG(name) #define GMOCK_FLAG_SET(name, value) (void)(::testing::GMOCK_FLAG(name) = value) -#endif // GTEST_HAS_ABSL +#endif // defined(GTEST_HAS_ABSL) && !defined(GTEST_NO_ABSL_FLAGS) #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_