diff options
author | Robin Lindén <dev@robinlinden.eu> | 2018-11-10 14:05:55 (GMT) |
---|---|---|
committer | Robin Lindén <dev@robinlinden.eu> | 2018-11-10 14:20:26 (GMT) |
commit | 826656b25f62ed0a2fadc7c5dde303616e621c08 (patch) | |
tree | 01db8e689dc6d256d0a5d65dad6d714cc39b8273 /googletest | |
parent | de5be0eb28b74ecd6335e3bd61d9dc8914ce0e57 (diff) | |
download | googletest-826656b25f62ed0a2fadc7c5dde303616e621c08.zip googletest-826656b25f62ed0a2fadc7c5dde303616e621c08.tar.gz googletest-826656b25f62ed0a2fadc7c5dde303616e621c08.tar.bz2 |
Remove workarounds for unsupported MSVC versions
Diffstat (limited to 'googletest')
-rw-r--r-- | googletest/cmake/internal_utils.cmake | 27 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-internal.h | 10 | ||||
-rw-r--r-- | googletest/include/gtest/internal/gtest-port.h | 17 | ||||
-rw-r--r-- | googletest/src/gtest.cc | 19 |
4 files changed, 9 insertions, 64 deletions
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake index 9867436..9be14c9 100644 --- a/googletest/cmake/internal_utils.cmake +++ b/googletest/cmake/internal_utils.cmake @@ -68,31 +68,6 @@ macro(config_compiler_and_linker) # Newlines inside flags variables break CMake's NMake generator. # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds. set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi") - if (MSVC_VERSION LESS 1400) # 1400 is Visual Studio 2005 - # Suppress spurious warnings MSVC 7.1 sometimes issues. - # Forcing value to bool. - set(cxx_base_flags "${cxx_base_flags} -wd4800") - # Copy constructor and assignment operator could not be generated. - set(cxx_base_flags "${cxx_base_flags} -wd4511 -wd4512") - # Compatibility warnings not applicable to Google Test. - # Resolved overload was found by argument-dependent lookup. - set(cxx_base_flags "${cxx_base_flags} -wd4675") - endif() - if (MSVC_VERSION LESS 1500) # 1500 is Visual Studio 2008 - # Conditional expression is constant. - # When compiling with /W4, we get several instances of C4127 - # (Conditional expression is constant). In our code, we disable that - # warning on a case-by-case basis. However, on Visual Studio 2005, - # the warning fires on std::list. Therefore on that compiler and earlier, - # we disable the warning project-wide. - set(cxx_base_flags "${cxx_base_flags} -wd4127") - endif() - if (NOT (MSVC_VERSION LESS 1700)) # 1700 is Visual Studio 2012. - # Suppress "unreachable code" warning on VS 2012 and later. - # http://stackoverflow.com/questions/3232669 explains the issue. - set(cxx_base_flags "${cxx_base_flags} -wd4702") - endif() - set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32") set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN") set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1") @@ -219,7 +194,7 @@ endfunction() # is built from the given source files with the given compiler flags. function(cxx_executable_with_flags name cxx_flags libs) add_executable(${name} ${ARGN}) - if (MSVC AND (NOT (MSVC_VERSION LESS 1700))) # 1700 is Visual Studio 2012. + if (MSVC) # BigObj required for tests. set(cxx_flags "${cxx_flags} -bigobj") endif() diff --git a/googletest/include/gtest/internal/gtest-internal.h b/googletest/include/gtest/internal/gtest-internal.h index 217ee79..d9d8533 100644 --- a/googletest/include/gtest/internal/gtest-internal.h +++ b/googletest/include/gtest/internal/gtest-internal.h @@ -840,16 +840,6 @@ struct RemoveConst<const T[N]> { typedef typename RemoveConst<T>::type type[N]; }; -#if defined(_MSC_VER) && _MSC_VER < 1400 -// This is the only specialization that allows VC++ 7.1 to remove const in -// 'const int[3] and 'const int[3][4]'. However, it causes trouble with GCC -// and thus needs to be conditionally compiled. -template <typename T, size_t N> -struct RemoveConst<T[N]> { - typedef typename RemoveConst<T>::type type[N]; -}; -#endif - // A handy wrapper around RemoveConst that works when the argument // T depends on template parameters. #define GTEST_REMOVE_CONST_(T) \ diff --git a/googletest/include/gtest/internal/gtest-port.h b/googletest/include/gtest/internal/gtest-port.h index b618289..9989b6b 100644 --- a/googletest/include/gtest/internal/gtest-port.h +++ b/googletest/include/gtest/internal/gtest-port.h @@ -304,16 +304,12 @@ // GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385) // /* code that triggers warnings C4800 and C4385 */ // GTEST_DISABLE_MSC_WARNINGS_POP_() -#if _MSC_VER >= 1400 +#if defined(_MSC_VER) # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \ __pragma(warning(push)) \ __pragma(warning(disable: warnings)) # define GTEST_DISABLE_MSC_WARNINGS_POP_() \ __pragma(warning(pop)) -#else -// Older versions of MSVC don't have __pragma. -# define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) -# define GTEST_DISABLE_MSC_WARNINGS_POP_() #endif // Clang on Windows does not understand MSVC's pragma warning. @@ -653,12 +649,10 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; #endif // GTEST_HAS_STREAM_REDIRECTION // Determines whether to support death tests. -// Google Test does not support death tests for VC 7.1 and earlier as -// abort() in a VC 7.1 application compiled as GUI in debug config // pops up a dialog window that cannot be suppressed programmatically. #if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ (GTEST_OS_MAC && !GTEST_OS_IOS) || \ - (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ + (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER) || \ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \ GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || \ GTEST_OS_NETBSD || GTEST_OS_FUCHSIA) @@ -669,7 +663,7 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION; // Typed tests need <typeinfo> and variadic macros, which GCC, VC++ 8.0, // Sun Pro CC, IBM Visual Age, and HP aCC support. -#if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ +#if defined(__GNUC__) || defined(_MSC_VER) || defined(__SUNPRO_CC) || \ defined(__IBMCPP__) || defined(__HP_aCC) # define GTEST_HAS_TYPED_TEST 1 # define GTEST_HAS_TYPED_TEST_P 1 @@ -2321,13 +2315,12 @@ GTEST_DISABLE_MSC_DEPRECATED_POP_() // MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate // function in order to achieve that. We use macro definition here because // snprintf is a variadic function. -#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE +#if _MSC_VER && !GTEST_OS_WINDOWS_MOBILE // MSVC 2005 and above support variadic macros. # define GTEST_SNPRINTF_(buffer, size, format, ...) \ _snprintf_s(buffer, size, size, format, __VA_ARGS__) #elif defined(_MSC_VER) -// Windows CE does not define _snprintf_s and MSVC prior to 2005 doesn't -// complain about _snprintf. +// Windows CE does not define _snprintf_s # define GTEST_SNPRINTF_ _snprintf #else # define GTEST_SNPRINTF_ snprintf diff --git a/googletest/src/gtest.cc b/googletest/src/gtest.cc index 06f09c3..4345e81 100644 --- a/googletest/src/gtest.cc +++ b/googletest/src/gtest.cc @@ -4537,24 +4537,17 @@ void TestEventListeners::SuppressEventForwarding() { // call this before main() starts, from which point on the return // value will never change. UnitTest* UnitTest::GetInstance() { - // When compiled with MSVC 7.1 in optimized mode, destroying the - // UnitTest object upon exiting the program messes up the exit code, - // causing successful tests to appear failed. We have to use a - // different implementation in this case to bypass the compiler bug. - // This implementation makes the compiler happy, at the cost of - // leaking the UnitTest object. - // CodeGear C++Builder insists on a public destructor for the // default implementation. Use this implementation to keep good OO // design with private destructor. -#if (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__) +#if defined(__BORLANDC__) static UnitTest* const instance = new UnitTest; return instance; #else static UnitTest instance; return &instance; -#endif // (_MSC_VER == 1310 && !defined(_DEBUG)) || defined(__BORLANDC__) +#endif // defined(__BORLANDC__) } // Gets the number of successful test cases. @@ -4812,18 +4805,12 @@ int UnitTest::Run() { _set_error_mode(_OUT_TO_STDERR); # endif -# if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE +# if defined(_MSC_VER) && !GTEST_OS_WINDOWS_MOBILE // In the debug version, Visual Studio pops up a separate dialog // offering a choice to debug the aborted program. We need to suppress // this dialog or it will pop up for every EXPECT/ASSERT_DEATH statement // executed. Google Test will notify the user of any unexpected // failure via stderr. - // - // VC++ doesn't define _set_abort_behavior() prior to the version 8.0. - // Users of prior VC versions shall suffer the agony and pain of - // clicking through the countless debug dialogs. - // FIXME: find a way to suppress the abort dialog() in the - // debug mode when compiled with VC 7.1 or lower. if (!GTEST_FLAG(break_on_failure)) _set_abort_behavior( 0x0, // Clear the following flags: |