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

@@ -27,17 +27,14 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Silence C4503 (decorated name length exceeded) for MSVC.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4503)
#endif
// Google Mock - a framework for writing C++ mock classes.
//
// This file tests the function mocker classes.
#include "gmock/gmock-function-mocker.h"
// Silence C4503 (decorated name length exceeded) for MSVC.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4503)
#if GTEST_OS_WINDOWS
// MSDN says the header file to be included for STDMETHOD is BaseTyps.h but
// we are getting compiler errors if we use basetyps.h, hence including
@@ -137,10 +134,7 @@ class FooInterface {
// significant in determining whether two virtual functions had the same
// signature. This was fixed in Visual Studio 2008. However, the compiler
// still emits a warning that alerts about this change in behavior.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4373)
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4373)
class MockFoo : public FooInterface {
public:
MockFoo() {}
@@ -285,9 +279,7 @@ class LegacyMockFoo : public FooInterface {
LegacyMockFoo& operator=(const LegacyMockFoo&) = delete;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4373
template <class T>
class FunctionMockerTest : public testing::Test {
@@ -1002,3 +994,5 @@ TEST(MockMethodMockFunctionTest, NoexceptSpecifierPreserved) {
} // namespace gmock_function_mocker_test
} // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4503