Remove workarounds for MSVC with versions _MSC_VER < 1925 GoogleTest only supports Visual Studio 2022 or later. PiperOrigin-RevId: 975742423 Change-Id: Ibc09f5cd2c8cb1f9097bd27b584ec136ec2ce42a
diff --git a/ci/windows-presubmit.bat b/ci/windows-presubmit.bat index cce732b..6ca533a 100644 --- a/ci/windows-presubmit.bat +++ b/ci/windows-presubmit.bat
@@ -69,7 +69,7 @@ --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 @@ --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
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 6512bbd..14696bc 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h
@@ -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 @@ 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 {
diff --git a/googlemock/include/gmock/internal/gmock-port.h b/googlemock/include/gmock/internal/gmock-port.h index 3bf0b81..46c6cd8 100644 --- a/googlemock/include/gmock/internal/gmock-port.h +++ b/googlemock/include/gmock/internal/gmock-port.h
@@ -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
diff --git a/googlemock/test/BUILD.bazel b/googlemock/test/BUILD.bazel index 27eb535..1e3f1db 100644 --- a/googlemock/test/BUILD.bazel +++ b/googlemock/test/BUILD.bazel
@@ -74,8 +74,7 @@ ":gmock_test_utils", ], tags = [ - "no_test_msvc2015", - "no_test_msvc2017", + "no_test_msvc2022", ], ) @@ -105,8 +104,7 @@ ":gmock_output_test_golden.txt", ], tags = [ - "no_test_msvc2015", - "no_test_msvc2017", + "no_test_msvc2022", ], deps = [":gmock_test_utils"], )
diff --git a/googletest/include/gtest/gtest-assertion-result.h b/googletest/include/gtest/gtest-assertion-result.h index d2b42a6..882e984 100644 --- a/googletest/include/gtest/gtest-assertion-result.h +++ b/googletest/include/gtest/gtest-assertion-result.h
@@ -143,11 +143,9 @@ // 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 @@ 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) {
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 696e9d1..4d7a541 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h
@@ -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 {
diff --git a/googletest/test/BUILD.bazel b/googletest/test/BUILD.bazel index 7561d3c..d2caea0 100644 --- a/googletest/test/BUILD.bazel +++ b/googletest/test/BUILD.bazel
@@ -611,8 +611,7 @@ 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 @@ 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"], )