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
This commit is contained in:
Tom Hughes
2023-01-30 13:44:59 -08:00
committed by Copybara-Service
parent f1c05d4544
commit 4fb7039fda
17 changed files with 72 additions and 149 deletions

View File

@@ -31,19 +31,6 @@
//
// This file tests the built-in actions.
// Silence C4100 (unreferenced formal parameter) and C4503 (decorated name
// length exceeded) for MSVC.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4100)
#pragma warning(disable : 4503)
#if _MSC_VER == 1900
// and silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 15
#pragma warning(disable : 4800)
#endif
#endif
#include "gmock/gmock-actions.h"
#include <algorithm>
@@ -59,6 +46,15 @@
#include "gtest/gtest-spi.h"
#include "gtest/gtest.h"
// Silence C4100 (unreferenced formal parameter) and C4503 (decorated name
// length exceeded) for MSVC.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4100 4503)
#if defined(_MSC_VER) && (_MSC_VER == 1900)
// and silence C4800 (C4800: 'int *const ': forcing value
// to bool 'true' or 'false') for MSVC 15
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800)
#endif
namespace testing {
namespace {
@@ -2165,3 +2161,8 @@ TEST(ActionMacro, LargeArity) {
} // namespace
} // namespace testing
#if defined(_MSC_VER) && (_MSC_VER == 1900)
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4800
#endif
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4100 4503