diff options
author | Tom Hughes <tomhughes@google.com> | 2023-01-30 13:44:59 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-01-30 13:45:46 -0800 |
commit | 4fb7039fda3f6588c7ca9664176f8c9e0a023b4a (patch) | |
tree | 5b66c8479ecb9fd98b4b790c0aaebe1a7b7fb0e9 /googlemock/include | |
parent | f1c05d4544964b060460a683c1cf31e02f0ba094 (diff) | |
download | googletest-git-4fb7039fda3f6588c7ca9664176f8c9e0a023b4a.tar.gz |
Use GTEST_DISABLE_MSC_WARNINGS macros to disable warnings
Prior to this change we had a mixture of pragmas and
GTEST_DISABLE_MSC_WARNINGS; this change consolidates all instances
to use the macros.
PiperOrigin-RevId: 505786926
Change-Id: I2be8f6304387393995081af42ed32c2ad1bba5a7
Diffstat (limited to 'googlemock/include')
-rw-r--r-- | googlemock/include/gmock/gmock-actions.h | 9 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-more-actions.h | 9 | ||||
-rw-r--r-- | googlemock/include/gmock/gmock-more-matchers.h | 14 | ||||
-rw-r--r-- | googlemock/include/gmock/internal/gmock-internal-utils.h | 10 |
4 files changed, 12 insertions, 30 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h index a6c2489f..1cffde2b 100644 --- a/googlemock/include/gmock/gmock-actions.h +++ b/googlemock/include/gmock/gmock-actions.h @@ -146,10 +146,7 @@ #include "gmock/internal/gmock-port.h" #include "gmock/internal/gmock-pp.h" -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) namespace testing { @@ -2295,8 +2292,6 @@ template <typename F, typename Impl> } // namespace testing -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 #endif // GOOGLEMOCK_INCLUDE_GMOCK_GMOCK_ACTIONS_H_ diff --git a/googlemock/include/gmock/gmock-more-actions.h b/googlemock/include/gmock/gmock-more-actions.h index 78169b1d..40300766 100644 --- a/googlemock/include/gmock/gmock-more-actions.h +++ b/googlemock/include/gmock/gmock-more-actions.h @@ -583,10 +583,7 @@ namespace testing { // the macro definition, as the warnings are generated when the macro // is expanded and macro expansion cannot contain #pragma. Therefore // we suppress them here. -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) namespace internal { @@ -654,9 +651,7 @@ InvokeArgument(Params &&...params) { internal::FlatTupleConstructTag{}, std::forward<Params>(params)...)}; } -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 } // namespace testing diff --git a/googlemock/include/gmock/gmock-more-matchers.h b/googlemock/include/gmock/gmock-more-matchers.h index d9a92107..54ea68be 100644 --- a/googlemock/include/gmock/gmock-more-matchers.h +++ b/googlemock/include/gmock/gmock-more-matchers.h @@ -49,14 +49,11 @@ namespace testing { // Silence C4100 (unreferenced formal // parameter) for MSVC -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#if (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100) +#if defined(_MSC_VER) && (_MSC_VER == 1900) // and silence C4800 (C4800: 'int *const ': forcing value // to bool 'true' or 'false') for MSVC 14 -#pragma warning(disable : 4800) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800) #endif namespace internal { @@ -113,9 +110,10 @@ MATCHER(IsFalse, negation ? "is true" : "is false") { return !static_cast<bool>(arg); } -#ifdef _MSC_VER -#pragma warning(pop) +#if defined(_MSC_VER) && (_MSC_VER == 1900) +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4800 #endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 } // namespace testing diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 36ab8e26..afbdce03 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -58,11 +58,7 @@ namespace internal { // Silence MSVC C4100 (unreferenced formal parameter) and // C4805('==': unsafe mix of type 'const int' and type 'const bool') -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4100) -#pragma warning(disable : 4805) -#endif +GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100 4805) // Joins a vector of strings as if they are fields of a tuple; returns // the joined string. @@ -480,9 +476,7 @@ using TupleElement = typename std::tuple_element<I, T>::type; bool Base64Unescape(const std::string& encoded, std::string* decoded); -#ifdef _MSC_VER -#pragma warning(pop) -#endif +GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 4805 } // namespace internal } // namespace testing |