Remove workarounds for MSVC with versions _MSC_VER < 1925

GoogleTest only supports Visual Studio 2022 or later.

PiperOrigin-RevId: 975742423
Change-Id: Ibc09f5cd2c8cb1f9097bd27b584ec136ec2ce42a
This commit is contained in:
Abseil Team
2026-09-03 08:29:26 -07:00
committed by Copybara-Service
parent efbef50b59
commit 283c17563f
7 changed files with 15 additions and 36 deletions
+2 -2
View File
@@ -69,7 +69,7 @@ IF EXIST "%KOKORO_GFILE_DIR%\distdir\googletest_vendor.tar.gz" (
--keep_going ^
--per_file_copt=external/.*@/w ^
--test_output=errors ^
--test_tag_filters=-no_test_msvc2017 ^
--test_tag_filters=-no_test_msvc2022 ^
%VENDOR_FLAG%
IF %errorlevel% neq 0 EXIT /B 1
@@ -84,6 +84,6 @@ IF %errorlevel% neq 0 EXIT /B 1
--keep_going ^
--per_file_copt=external/.*@/w ^
--test_output=errors ^
--test_tag_filters=-no_test_msvc2017 ^
--test_tag_filters=-no_test_msvc2022 ^
%VENDOR_FLAG%
IF %errorlevel% neq 0 EXIT /B 1
+1 -8
View File
@@ -277,13 +277,6 @@
#include "gtest/gtest.h"
#include "gtest/internal/gtest-internal.h"
// MSVC warning C5046 is new as of VS2017 version 15.8.
#if defined(_MSC_VER) && _MSC_VER >= 1915
#define GMOCK_MAYBE_5046_ 5046
#else
#define GMOCK_MAYBE_5046_
#endif
#if GTEST_HAS_RTTI
namespace proto2 {
namespace internal {
@@ -324,7 +317,7 @@ T* DynamicCastMessageForGtest(proto2::MessageLite* msg) {
GTEST_DISABLE_MSC_WARNINGS_PUSH_(
// class A needs to have dll-interface to be used by clients of class B
4251 GMOCK_MAYBE_5046_
4251 5046
/* Symbol involving type with internal linkage not defined */)
namespace testing {
@@ -62,10 +62,11 @@
#include "absl/flags/flag.h"
#endif
// For MS Visual C++, check the compiler version. At least VS 2015 is
// required to compile Google Mock.
#if defined(_MSC_VER) && _MSC_VER < 1900
#error "At least Visual C++ 2015 (14.0) is required to compile Google Mock."
// For MS Visual C++, check the compiler version. At least VS 2022 is
// required to compile Google Mock (_MSC_VER >= 1930). We use a slightly lower
// version for internal toolchains lagging behind.
#if defined(_MSC_VER) && _MSC_VER < 1925
#error "At least Visual C++ 2022 (17.0) is required to compile Google Mock."
#endif
// Macro for referencing flags. This is public as we want the user to
+2 -4
View File
@@ -74,8 +74,7 @@ py_test(
":gmock_test_utils",
],
tags = [
"no_test_msvc2015",
"no_test_msvc2017",
"no_test_msvc2022",
],
)
@@ -105,8 +104,7 @@ py_test(
":gmock_output_test_golden.txt",
],
tags = [
"no_test_msvc2015",
"no_test_msvc2017",
"no_test_msvc2022",
],
deps = [":gmock_test_utils"],
)
@@ -143,11 +143,9 @@ class GTEST_API_ [[nodiscard]] AssertionResult {
// Used in EXPECT_TRUE/FALSE(assertion_result).
AssertionResult(const AssertionResult& other);
// C4800 is off by default starting in Visual Studio 2019 but can be
// enabled with command-line options.
#if defined(_MSC_VER) && _MSC_VER >= 1920
// C4800 is off by default starting in Visual Studio 2019 but can be
// enabled with command-line options.
GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 /* forcing value to bool */)
#endif
// Used in the EXPECT_TRUE/FALSE(bool_expression).
//
@@ -169,9 +167,7 @@ class GTEST_API_ [[nodiscard]] AssertionResult {
int> = 0>
explicit AssertionResult(const T& success) : success_(success) {}
#if defined(_MSC_VER) && _MSC_VER >= 1920
GTEST_DISABLE_MSC_WARNINGS_POP_()
#endif
// Assignment operator.
AssertionResult& operator=(AssertionResult other) {
+1 -8
View File
@@ -52,16 +52,9 @@
#include "gtest/internal/gtest-internal.h"
#include "gtest/internal/gtest-port.h"
// MSVC warning C5046 is new as of VS2017 version 15.8.
#if defined(_MSC_VER) && _MSC_VER >= 1915
#define GTEST_MAYBE_5046_ 5046
#else
#define GTEST_MAYBE_5046_
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_(
// class A needs to have dll-interface to be used by clients of class B
4251 GTEST_MAYBE_5046_
4251 5046
/* Symbol involving type with internal linkage not defined */)
namespace testing {
+2 -4
View File
@@ -611,8 +611,7 @@ py_test(
srcs = ["googletest-param-test-invalid-name1-test.py"],
data = [":googletest-param-test-invalid-name1-test_"],
tags = [
"no_test_msvc2015",
"no_test_msvc2017",
"no_test_msvc2022",
],
deps = [":gtest_test_utils"],
)
@@ -623,8 +622,7 @@ py_test(
srcs = ["googletest-param-test-invalid-name2-test.py"],
data = [":googletest-param-test-invalid-name2-test_"],
tags = [
"no_test_msvc2015",
"no_test_msvc2017",
"no_test_msvc2022",
],
deps = [":gtest_test_utils"],
)