summaryrefslogtreecommitdiffstats
path: root/googletest/include/gtest/internal/gtest-port.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2021-07-02 21:01:11 (GMT)
committerDerek Mauro <dmauro@google.com>2021-07-07 18:34:19 (GMT)
commit977cffc4423a2d6c0df3fc9a7b5253b8f79c3f18 (patch)
treef984ad508b34bbdfb1812efaffe5b62e35ab70ae /googletest/include/gtest/internal/gtest-port.h
parent4cfd14984fb0ae68ae434ae6e82d67b75986adec (diff)
downloadgoogletest-977cffc4423a2d6c0df3fc9a7b5253b8f79c3f18.zip
googletest-977cffc4423a2d6c0df3fc9a7b5253b8f79c3f18.tar.gz
googletest-977cffc4423a2d6c0df3fc9a7b5253b8f79c3f18.tar.bz2
Googletest export
Introduce GTEST_FLAG_GET and GTEST_FLAG_SET macros. PiperOrigin-RevId: 382808313
Diffstat (limited to 'googletest/include/gtest/internal/gtest-port.h')
-rw-r--r--googletest/include/gtest/internal/gtest-port.h40
1 files changed, 29 insertions, 11 deletions
diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h
index 361354b..524bbeb 100644
--- a/googletest/include/gtest/internal/gtest-port.h
+++ b/googletest/include/gtest/internal/gtest-port.h
@@ -2216,22 +2216,40 @@ using TimeInMillis = int64_t; // Represents time in milliseconds.
# define GTEST_FLAG_SAVER_ ::testing::internal::GTestFlagSaver
// Macros for declaring flags.
-# define GTEST_DECLARE_bool_(name) GTEST_API_ extern bool GTEST_FLAG(name)
-# define GTEST_DECLARE_int32_(name) \
- GTEST_API_ extern std::int32_t GTEST_FLAG(name)
-# define GTEST_DECLARE_string_(name) \
- GTEST_API_ extern ::std::string GTEST_FLAG(name)
+#define GTEST_DECLARE_bool_(name) \
+ namespace testing { \
+ GTEST_API_ extern bool GTEST_FLAG(name); \
+ }
+#define GTEST_DECLARE_int32_(name) \
+ namespace testing { \
+ GTEST_API_ extern std::int32_t GTEST_FLAG(name); \
+ }
+#define GTEST_DECLARE_string_(name) \
+ namespace testing { \
+ GTEST_API_ extern ::std::string GTEST_FLAG(name); \
+ }
// Macros for defining flags.
-# define GTEST_DEFINE_bool_(name, default_val, doc) \
- GTEST_API_ bool GTEST_FLAG(name) = (default_val)
-# define GTEST_DEFINE_int32_(name, default_val, doc) \
- GTEST_API_ std::int32_t GTEST_FLAG(name) = (default_val)
-# define GTEST_DEFINE_string_(name, default_val, doc) \
- GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val)
+#define GTEST_DEFINE_bool_(name, default_val, doc) \
+ namespace testing { \
+ GTEST_API_ bool GTEST_FLAG(name) = (default_val); \
+ }
+#define GTEST_DEFINE_int32_(name, default_val, doc) \
+ namespace testing { \
+ GTEST_API_ std::int32_t GTEST_FLAG(name) = (default_val); \
+ }
+#define GTEST_DEFINE_string_(name, default_val, doc) \
+ namespace testing { \
+ GTEST_API_ ::std::string GTEST_FLAG(name) = (default_val); \
+ }
#endif // !defined(GTEST_DECLARE_bool_)
+#if !defined(GTEST_FLAG_GET)
+#define GTEST_FLAG_GET(name) ::testing::GTEST_FLAG(name)
+#define GTEST_FLAG_SET(name, value) (void)(::testing::GTEST_FLAG(name) = value)
+#endif // !defined(GTEST_FLAG_GET)
+
// Thread annotations
#if !defined(GTEST_EXCLUSIVE_LOCK_REQUIRED_)
# define GTEST_EXCLUSIVE_LOCK_REQUIRED_(locks)