diff options
author | Abseil Team <absl-team@google.com> | 2021-09-14 18:59:42 (GMT) |
---|---|---|
committer | Derek Mauro <dmauro@google.com> | 2021-09-15 17:33:42 (GMT) |
commit | 6202251f0963187a7781f181365cf8c19bf343d5 (patch) | |
tree | 11dcdadad81eea51b6db2f229270b7556199c490 /googlemock/include/gmock/internal | |
parent | 159c9ad23e8b276e8c975bb8621c81d4df5fd863 (diff) | |
download | googletest-6202251f0963187a7781f181365cf8c19bf343d5.zip googletest-6202251f0963187a7781f181365cf8c19bf343d5.tar.gz googletest-6202251f0963187a7781f181365cf8c19bf343d5.tar.bz2 |
Googletest export
Introduce GMOCK_FLAG_GET and GMOCK_FLAG_SET macros.
PiperOrigin-RevId: 396649214
Diffstat (limited to 'googlemock/include/gmock/internal')
-rw-r--r-- | googlemock/include/gmock/internal/custom/README.md | 2 | ||||
-rw-r--r-- | googlemock/include/gmock/internal/gmock-port.h | 40 |
2 files changed, 31 insertions, 11 deletions
diff --git a/googlemock/include/gmock/internal/custom/README.md b/googlemock/include/gmock/internal/custom/README.md index f6c93f6..9c4874f 100644 --- a/googlemock/include/gmock/internal/custom/README.md +++ b/googlemock/include/gmock/internal/custom/README.md @@ -14,3 +14,5 @@ The following macros can be defined: * `GMOCK_DEFINE_bool_(name, default_val, doc)` * `GMOCK_DEFINE_int32_(name, default_val, doc)` * `GMOCK_DEFINE_string_(name, default_val, doc)` +* `GMOCK_FLAG_GET(flag_name)` +* `GMOCK_FLAG_SET(flag_name, value)` diff --git a/googlemock/include/gmock/internal/gmock-port.h b/googlemock/include/gmock/internal/gmock-port.h index d2d1b74..7ec0730 100644 --- a/googlemock/include/gmock/internal/gmock-port.h +++ b/googlemock/include/gmock/internal/gmock-port.h @@ -67,19 +67,37 @@ #if !defined(GMOCK_DECLARE_bool_) // Macros for declaring flags. -# define GMOCK_DECLARE_bool_(name) extern GTEST_API_ bool GMOCK_FLAG(name) -# define GMOCK_DECLARE_int32_(name) extern GTEST_API_ int32_t GMOCK_FLAG(name) -# define GMOCK_DECLARE_string_(name) \ - extern GTEST_API_ ::std::string GMOCK_FLAG(name) +#define GMOCK_DECLARE_bool_(name) \ + namespace testing { \ + GTEST_API_ extern bool GMOCK_FLAG(name); \ + } +#define GMOCK_DECLARE_int32_(name) \ + namespace testing { \ + GTEST_API_ extern int32_t GMOCK_FLAG(name); \ + } +#define GMOCK_DECLARE_string_(name) \ + namespace testing { \ + GTEST_API_ extern ::std::string GMOCK_FLAG(name); \ + } // Macros for defining flags. -# define GMOCK_DEFINE_bool_(name, default_val, doc) \ - GTEST_API_ bool GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_int32_(name, default_val, doc) \ - GTEST_API_ int32_t GMOCK_FLAG(name) = (default_val) -# define GMOCK_DEFINE_string_(name, default_val, doc) \ - GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val) - +#define GMOCK_DEFINE_bool_(name, default_val, doc) \ + namespace testing { \ + GTEST_API_ bool GMOCK_FLAG(name) = (default_val); \ + } +#define GMOCK_DEFINE_int32_(name, default_val, doc) \ + namespace testing { \ + GTEST_API_ int32_t GMOCK_FLAG(name) = (default_val); \ + } +#define GMOCK_DEFINE_string_(name, default_val, doc) \ + namespace testing { \ + GTEST_API_ ::std::string GMOCK_FLAG(name) = (default_val); \ + } #endif // !defined(GMOCK_DECLARE_bool_) +#if !defined(GMOCK_FLAG_GET) +#define GMOCK_FLAG_GET(name) ::testing::GMOCK_FLAG(name) +#define GMOCK_FLAG_SET(name, value) (void)(::testing::GMOCK_FLAG(name) = value) +#endif // !defined(GMOCK_FLAG_GET) + #endif // GOOGLEMOCK_INCLUDE_GMOCK_INTERNAL_GMOCK_PORT_H_ |