diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-03-31 16:27:55 +0000 |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-03-31 16:27:55 +0000 |
commit | 6a26383e31cf79dd0acf89bf3a53c7a805decf1d (patch) | |
tree | 95a4ccf0c315fb0f8020f3e06c871f97eb44ddd9 | |
parent | 3e54f5a3715f2c0b4425e55cc5d42dd42f4eda54 (diff) | |
download | googletest-6a26383e31cf79dd0acf89bf3a53c7a805decf1d.tar.gz googletest-6a26383e31cf79dd0acf89bf3a53c7a805decf1d.tar.bz2 googletest-6a26383e31cf79dd0acf89bf3a53c7a805decf1d.zip |
Cleans up the use of GTEST_OS_WINDOWS and _MSC_VER.
-rw-r--r-- | include/gtest/gtest.h | 9 | ||||
-rw-r--r-- | include/gtest/internal/gtest-port.h | 8 | ||||
-rw-r--r-- | src/gtest-port.cc | 6 | ||||
-rw-r--r-- | src/gtest.cc | 6 | ||||
-rw-r--r-- | test/gtest_unittest.cc | 8 |
5 files changed, 13 insertions, 24 deletions
diff --git a/include/gtest/gtest.h b/include/gtest/gtest.h index 9b72b636..6d87e035 100644 --- a/include/gtest/gtest.h +++ b/include/gtest/gtest.h @@ -51,15 +51,8 @@ #ifndef GTEST_INCLUDE_GTEST_GTEST_H_ #define GTEST_INCLUDE_GTEST_GTEST_H_ -// The following platform macros are used throughout Google Test: +// The following platform macro is used throughout Google Test: // _WIN32_WCE Windows CE (set in project files) -// -// Note that even though _MSC_VER and _WIN32_WCE really indicate a compiler -// and a Win32 implementation, respectively, we use them to indicate the -// combination of compiler - Win 32 API - C library, since the code currently -// only supports: -// Windows proper with Visual C++ and MS C library (_MSC_VER && !_WIN32_WCE) and -// Windows Mobile with Visual C++ and no C library (_WIN32_WCE). #include <limits> #include <gtest/internal/gtest-internal.h> diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index a304b0ae..054851bc 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -172,11 +172,7 @@ #define GTEST_OS_CYGWIN 1 #elif __SYMBIAN32__ #define GTEST_OS_SYMBIAN 1 -#elif defined _MSC_VER -// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean -// both "The OS is Windows" and "The compiler is MSVC". These -// meanings really should be separated in order to better support -// Windows compilers other than MSVC. +#elif defined _WIN32 #define GTEST_OS_WINDOWS 1 #elif defined __APPLE__ #define GTEST_OS_MAC 1 @@ -186,7 +182,7 @@ #define GTEST_OS_ZOS 1 #elif defined(__sun) && defined(__SVR4) #define GTEST_OS_SOLARIS 1 -#endif // _MSC_VER +#endif // __CYGWIN__ #if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC diff --git a/src/gtest-port.cc b/src/gtest-port.cc index ef213892..166ff414 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -62,12 +62,12 @@ namespace testing { namespace internal { -#if GTEST_OS_WINDOWS -// Microsoft does not provide a definition of STDERR_FILENO. +#ifdef _MSC_VER +// MSVC does not provide a definition of STDERR_FILENO. const int kStdErrFileno = 2; #else const int kStdErrFileno = STDERR_FILENO; -#endif // GTEST_OS_WINDOWS +#endif // _MSC_VER #if GTEST_USES_POSIX_RE diff --git a/src/gtest.cc b/src/gtest.cc index e98f63fa..ac5ed9d5 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -1710,16 +1710,16 @@ String String::Format(const char * format, ...) { char buffer[4096]; // MSVC 8 deprecates vsnprintf(), so we want to suppress warning // 4996 (deprecated function) there. -#if GTEST_OS_WINDOWS // We are on Windows. +#ifdef _MSC_VER // We are using MSVC. #pragma warning(push) // Saves the current warning state. #pragma warning(disable:4996) // Temporarily disables warning 4996. const int size = vsnprintf(buffer, sizeof(buffer)/sizeof(buffer[0]) - 1, format, args); #pragma warning(pop) // Restores the warning state. -#else // We are on Linux or Mac OS. +#else // We are not using MSVC. const int size = vsnprintf(buffer, sizeof(buffer)/sizeof(buffer[0]) - 1, format, args); -#endif // GTEST_OS_WINDOWS +#endif // _MSC_VER va_end(args); return String(size >= 0 ? buffer : "<buffer exceeded>"); diff --git a/test/gtest_unittest.cc b/test/gtest_unittest.cc index 9a731eeb..8e4b813c 100644 --- a/test/gtest_unittest.cc +++ b/test/gtest_unittest.cc @@ -3148,9 +3148,9 @@ TEST(AssertionTest, ExpectWorksWithUncopyableObject) { // The version of gcc used in XCode 2.2 has a bug and doesn't allow -// anonymous enums in assertions. Therefore the following test is -// done only on Linux and Windows. -#if GTEST_OS_LINUX || GTEST_OS_WINDOWS +// anonymous enums in assertions. Therefore the following test is not +// done on Mac. +#if !GTEST_OS_MAC // Tests using assertions with anonymous enums. enum { @@ -3195,7 +3195,7 @@ TEST(AssertionTest, AnonymousEnum) { "Value of: CASE_B"); } -#endif // GTEST_OS_LINUX || GTEST_OS_WINDOWS +#endif // !GTEST_OS_MAC #if GTEST_OS_WINDOWS |