From 0af0709b02899f9177db55eba7929e65e5834b29 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Mon, 23 Feb 2009 23:21:55 +0000 Subject: Cleans up macro definitions. --- src/gtest-death-test.cc | 14 +++--- src/gtest-filepath.cc | 20 ++++----- src/gtest-internal-inl.h | 20 ++++----- src/gtest-port.cc | 13 +++--- src/gtest-test-part.cc | 4 +- src/gtest-typed-test.cc | 2 +- src/gtest.cc | 110 +++++++++++++++++++++++------------------------ 7 files changed, 92 insertions(+), 91 deletions(-) (limited to 'src') diff --git a/src/gtest-death-test.cc b/src/gtest-death-test.cc index 6499842c..7bb36490 100644 --- a/src/gtest-death-test.cc +++ b/src/gtest-death-test.cc @@ -34,7 +34,7 @@ #include #include -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST #include #include #include @@ -48,9 +48,9 @@ // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in // his code. -#define GTEST_IMPLEMENTATION +#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION +#undef GTEST_IMPLEMENTATION_ namespace testing { @@ -90,7 +90,7 @@ GTEST_DEFINE_string_( "death test. FOR INTERNAL USE ONLY."); } // namespace internal -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST // ExitedWithCode constructor. ExitedWithCode::ExitedWithCode(int exit_code) : exit_code_(exit_code) { @@ -144,7 +144,7 @@ bool ExitedUnsuccessfully(int exit_status) { static String DeathTestThreadWarning(size_t thread_count) { Message msg; msg << "Death tests use fork(), which is unsafe particularly" - << " in a threaded context. For this test, " << GTEST_NAME << " "; + << " in a threaded context. For this test, " << GTEST_NAME_ << " "; if (thread_count == 0) msg << "couldn't detect the number of threads."; else @@ -655,11 +655,11 @@ DeathTest::TestRole ExecDeathTest::AssumeRole() { const String filter_flag = String::Format("--%s%s=%s.%s", - GTEST_FLAG_PREFIX, kFilterFlag, + GTEST_FLAG_PREFIX_, kFilterFlag, info->test_case_name(), info->name()); const String internal_flag = String::Format("--%s%s=%s:%d:%d:%d", - GTEST_FLAG_PREFIX, kInternalRunDeathTestFlag, file_, line_, + GTEST_FLAG_PREFIX_, kInternalRunDeathTestFlag, file_, line_, death_test_index, pipe_fd[1]); Arguments args; args.AddArguments(GetArgvs()); diff --git a/src/gtest-filepath.cc b/src/gtest-filepath.cc index ebf7cf93..e5908012 100644 --- a/src/gtest-filepath.cc +++ b/src/gtest-filepath.cc @@ -36,11 +36,11 @@ #ifdef _WIN32_WCE #include -#elif defined(GTEST_OS_WINDOWS) +#elif GTEST_OS_WINDOWS #include #include #include -#elif defined(GTEST_OS_SYMBIAN) +#elif GTEST_OS_SYMBIAN // Symbian OpenC has PATH_MAX in sys/syslimits.h #include #include @@ -50,7 +50,7 @@ #include // NOLINT #endif // _WIN32_WCE or _WIN32 -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS #define GTEST_PATH_MAX_ _MAX_PATH #elif defined(PATH_MAX) #define GTEST_PATH_MAX_ PATH_MAX @@ -65,7 +65,7 @@ namespace testing { namespace internal { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS const char kPathSeparator = '\\'; const char kPathSeparatorString[] = "\\"; #ifdef _WIN32_WCE @@ -90,7 +90,7 @@ FilePath FilePath::GetCurrentDir() { // Windows CE doesn't have a current directory, so we just return // something reasonable. return FilePath(kCurrentDirectoryString); -#elif defined(GTEST_OS_WINDOWS) +#elif GTEST_OS_WINDOWS char cwd[GTEST_PATH_MAX_ + 1] = {}; return FilePath(_getcwd(cwd, sizeof(cwd)) == NULL ? "" : cwd); #else @@ -165,7 +165,7 @@ FilePath FilePath::ConcatPaths(const FilePath& directory, // Returns true if pathname describes something findable in the file-system, // either a file, directory, or whatever. bool FilePath::FileOrDirectoryExists() const { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS #ifdef _WIN32_WCE LPCWSTR unicode = String::AnsiToUtf16(pathname_.c_str()); const DWORD attributes = GetFileAttributes(unicode); @@ -185,7 +185,7 @@ bool FilePath::FileOrDirectoryExists() const { // that exists. bool FilePath::DirectoryExists() const { bool result = false; -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // Don't strip off trailing separator if path is a root directory on // Windows (like "C:\\"). const FilePath& path(IsRootDirectory() ? *this : @@ -214,7 +214,7 @@ bool FilePath::DirectoryExists() const { // Returns true if pathname describes a root directory. (Windows has one // root directory per disk drive.) bool FilePath::IsRootDirectory() const { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // TODO(wan@google.com): on Windows a network share like // \\server\share can be a root directory, although it cannot be the // current directory. Handle this properly. @@ -227,7 +227,7 @@ bool FilePath::IsRootDirectory() const { // Returns true if pathname describes an absolute path. bool FilePath::IsAbsolutePath() const { const char* const name = pathname_.c_str(); -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS return pathname_.GetLength() >= 3 && ((name[0] >= 'a' && name[0] <= 'z') || (name[0] >= 'A' && name[0] <= 'Z')) && @@ -285,7 +285,7 @@ bool FilePath::CreateDirectoriesRecursively() const { // directory for any reason, including if the parent directory does not // exist. Not named "CreateDirectory" because that's a macro on Windows. bool FilePath::CreateFolder() const { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS #ifdef _WIN32_WCE FilePath removed_sep(this->RemoveTrailingPathSeparator()); LPCWSTR unicode = String::AnsiToUtf16(removed_sep.c_str()); diff --git a/src/gtest-internal-inl.h b/src/gtest-internal-inl.h index 07d0c5b4..b1a5dbb1 100644 --- a/src/gtest-internal-inl.h +++ b/src/gtest-internal-inl.h @@ -37,19 +37,19 @@ #ifndef GTEST_SRC_GTEST_INTERNAL_INL_H_ #define GTEST_SRC_GTEST_INTERNAL_INL_H_ -// GTEST_IMPLEMENTATION is defined iff the current translation unit is -// part of Google Test's implementation. -#ifndef GTEST_IMPLEMENTATION +// GTEST_IMPLEMENTATION_ is defined to 1 iff the current translation unit is +// part of Google Test's implementation; otherwise it's undefined. +#if !GTEST_IMPLEMENTATION_ // A user is trying to include this from his code - just say no. #error "gtest-internal-inl.h is part of Google Test's internal implementation." #error "It must not be included except by Google Test itself." -#endif // GTEST_IMPLEMENTATION +#endif // GTEST_IMPLEMENTATION_ #include #include -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS #include // NOLINT #endif // GTEST_OS_WINDOWS @@ -833,7 +833,7 @@ class UnitTestOptions { static bool FilterMatchesTest(const String &test_case_name, const String &test_name); -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // Function for supporting the gtest_catch_exception flag. // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the @@ -1095,7 +1095,7 @@ class UnitTestImpl { tear_down_tc)->AddTestInfo(test_info); } -#ifdef GTEST_HAS_PARAM_TEST +#if GTEST_HAS_PARAM_TEST // Returns ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. internal::ParameterizedTestCaseRegistry& parameterized_test_registry() { @@ -1175,7 +1175,7 @@ class UnitTestImpl { return gtest_trace_stack_.pointer(); } -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST // Returns a pointer to the parsed --gtest_internal_run_death_test // flag, or NULL if that flag was not specified. // This information is useful only in a death test child process. @@ -1224,7 +1224,7 @@ class UnitTestImpl { internal::List test_cases_; // The list of TestCases. -#ifdef GTEST_HAS_PARAM_TEST +#if GTEST_HAS_PARAM_TEST // ParameterizedTestRegistry object used to register value-parameterized // tests. internal::ParameterizedTestCaseRegistry parameterized_test_registry_; @@ -1273,7 +1273,7 @@ class UnitTestImpl { // How long the test took to run, in milliseconds. TimeInMillis elapsed_time_; -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST // The decomposed components of the gtest_internal_run_death_test flag, // parsed when RUN_ALL_TESTS is called. internal::scoped_ptr internal_run_death_test_flag_; diff --git a/src/gtest-port.cc b/src/gtest-port.cc index 9348f55c..59a22308 100644 --- a/src/gtest-port.cc +++ b/src/gtest-port.cc @@ -35,7 +35,7 @@ #include #include -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST #include #endif // GTEST_HAS_DEATH_TEST @@ -56,9 +56,9 @@ // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in // his code. -#define GTEST_IMPLEMENTATION +#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION +#undef GTEST_IMPLEMENTATION_ namespace testing { namespace internal { @@ -334,7 +334,7 @@ bool RE::PartialMatch(const char* str, const RE& re) { void RE::Init(const char* regex) { pattern_ = full_pattern_ = NULL; if (regex != NULL) { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS pattern_ = _strdup(regex); #else pattern_ = strdup(regex); @@ -383,7 +383,7 @@ void GTestLog(GTestLogSeverity severity, const char* file, } } -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST // Defines the stderr capturer. @@ -502,7 +502,8 @@ void abort() { // given flag. For example, FlagToEnvVar("foo") will return // "GTEST_FOO" in the open-source version. static String FlagToEnvVar(const char* flag) { - const String full_flag = (Message() << GTEST_FLAG_PREFIX << flag).GetString(); + const String full_flag = + (Message() << GTEST_FLAG_PREFIX_ << flag).GetString(); Message env_var; for (int i = 0; i != full_flag.GetLength(); i++) { diff --git a/src/gtest-test-part.cc b/src/gtest-test-part.cc index dcd30b25..2cb55856 100644 --- a/src/gtest-test-part.cc +++ b/src/gtest-test-part.cc @@ -38,9 +38,9 @@ // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in // his code. -#define GTEST_IMPLEMENTATION +#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION +#undef GTEST_IMPLEMENTATION_ namespace testing { diff --git a/src/gtest-typed-test.cc b/src/gtest-typed-test.cc index d42a1596..cb91f2b2 100644 --- a/src/gtest-typed-test.cc +++ b/src/gtest-typed-test.cc @@ -35,7 +35,7 @@ namespace testing { namespace internal { -#ifdef GTEST_HAS_TYPED_TEST_P +#if GTEST_HAS_TYPED_TEST_P // Verifies that registered_tests match the test names in // defined_test_names_; returns registered_tests if successful, or diff --git a/src/gtest.cc b/src/gtest.cc index 0d161e0e..e4f9d0f3 100644 --- a/src/gtest.cc +++ b/src/gtest.cc @@ -43,11 +43,11 @@ #include #include -#ifdef GTEST_OS_LINUX +#if GTEST_OS_LINUX // TODO(kenton@google.com): Use autoconf to detect availability of // gettimeofday(). -#define GTEST_HAS_GETTIMEOFDAY +#define GTEST_HAS_GETTIMEOFDAY_ 1 #include #include @@ -60,12 +60,12 @@ #include #include -#elif defined(GTEST_OS_SYMBIAN) -#define GTEST_HAS_GETTIMEOFDAY +#elif GTEST_OS_SYMBIAN +#define GTEST_HAS_GETTIMEOFDAY_ 1 #include // NOLINT -#elif defined(GTEST_OS_ZOS) -#define GTEST_HAS_GETTIMEOFDAY +#elif GTEST_OS_ZOS +#define GTEST_HAS_GETTIMEOFDAY_ 1 #include // NOLINT // On z/OS we additionally need strings.h for strcasecmp. @@ -75,7 +75,7 @@ #include // NOLINT -#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper. +#elif GTEST_OS_WINDOWS // We are on Windows proper. #include // NOLINT #include // NOLINT @@ -89,9 +89,9 @@ // TODO(kenton@google.com): There are other ways to get the time on // Windows, like GetTickCount() or GetSystemTimeAsFileTime(). MinGW // supports these. consider using them instead. -#define GTEST_HAS_GETTIMEOFDAY +#define GTEST_HAS_GETTIMEOFDAY_ 1 #include // NOLINT -#endif +#endif // defined(__MINGW__) || defined(__MINGW32__) // cpplint thinks that the header is already included, so we want to // silence it. @@ -102,25 +102,25 @@ // Assume other platforms have gettimeofday(). // TODO(kenton@google.com): Use autoconf to detect availability of // gettimeofday(). -#define GTEST_HAS_GETTIMEOFDAY +#define GTEST_HAS_GETTIMEOFDAY_ 1 // cpplint thinks that the header is already included, so we want to // silence it. #include // NOLINT #include // NOLINT -#endif +#endif // GTEST_OS_LINUX // Indicates that this translation unit is part of Google Test's // implementation. It must come before gtest-internal-inl.h is // included, or there will be a compiler error. This trick is to // prevent a user from accidentally including gtest-internal-inl.h in // his code. -#define GTEST_IMPLEMENTATION +#define GTEST_IMPLEMENTATION_ 1 #include "src/gtest-internal-inl.h" -#undef GTEST_IMPLEMENTATION +#undef GTEST_IMPLEMENTATION_ -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS #define fileno _fileno #define isatty _isatty #define vsnprintf _vsnprintf @@ -173,7 +173,7 @@ GTEST_DEFINE_bool_( GTEST_DEFINE_bool_( catch_exceptions, internal::BoolFromGTestEnv("catch_exceptions", false), - "True iff " GTEST_NAME + "True iff " GTEST_NAME_ " should catch exceptions and treat them as test failures."); GTEST_DEFINE_string_( @@ -211,7 +211,7 @@ GTEST_DEFINE_string_( GTEST_DEFINE_bool_( print_time, internal::BoolFromGTestEnv("print_time", false), - "True iff " GTEST_NAME + "True iff " GTEST_NAME_ " should display elapsed time in text output."); GTEST_DEFINE_int32_( @@ -228,7 +228,7 @@ GTEST_DEFINE_int32_( GTEST_DEFINE_bool_( show_internal_stack_frames, false, - "True iff " GTEST_NAME " should include internal stack frames when " + "True iff " GTEST_NAME_ " should include internal stack frames when " "printing test failure stack traces."); namespace internal { @@ -302,7 +302,7 @@ String g_executable_path; FilePath GetCurrentExecutableName() { FilePath result; -#if defined(_WIN32_WCE) || defined(GTEST_OS_WINDOWS) +#if defined(_WIN32_WCE) || GTEST_OS_WINDOWS result.Set(FilePath(g_executable_path).RemoveExtension("exe")); #else result.Set(FilePath(g_executable_path)); @@ -433,7 +433,7 @@ bool UnitTestOptions::FilterMatchesTest(const String &test_case_name, !MatchesFilter(full_name, negative.c_str())); } -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // Returns EXCEPTION_EXECUTE_HANDLER if Google Test should handle the // given SEH exception, or EXCEPTION_CONTINUE_SEARCH otherwise. // This function is useful as an __except condition. @@ -743,7 +743,7 @@ static TimeInMillis GetTimeInMillis() { return now_int64.QuadPart; } return 0; -#elif defined(GTEST_OS_WINDOWS) && !defined(GTEST_HAS_GETTIMEOFDAY) +#elif GTEST_OS_WINDOWS && !GTEST_HAS_GETTIMEOFDAY_ __timeb64 now; #ifdef _MSC_VER // MSVC 8 deprecates _ftime64(), so we want to suppress warning 4996 @@ -758,7 +758,7 @@ static TimeInMillis GetTimeInMillis() { _ftime64(&now); #endif // _MSC_VER return static_cast(now.time) * 1000 + now.millitm; -#elif defined(GTEST_HAS_GETTIMEOFDAY) +#elif GTEST_HAS_GETTIMEOFDAY_ struct timeval now; gettimeofday(&now, NULL); return static_cast(now.tv_sec) * 1000 + now.tv_usec / 1000; @@ -793,7 +793,7 @@ static char* CloneString(const char* str, size_t length) { char* const clone = new char[length + 1]; // MSVC 8 deprecates strncpy(), so we want to suppress warning // 4996 (deprecated function) there. -#ifdef GTEST_OS_WINDOWS // We are on Windows. +#if GTEST_OS_WINDOWS // We are on Windows. #pragma warning(push) // Saves the current warning state. #pragma warning(disable:4996) // Temporarily disables warning 4996. strncpy(clone, str, length); @@ -1314,7 +1314,7 @@ AssertionResult IsNotSubstring( namespace internal { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS namespace { @@ -1442,14 +1442,14 @@ char* CodePointToUtf8(UInt32 code_point, char* str) { // null-terminate the destination string. // MSVC 8 deprecates strncpy(), so we want to suppress warning // 4996 (deprecated function) there. -#ifdef GTEST_OS_WINDOWS // We are on Windows. +#if GTEST_OS_WINDOWS // We are on Windows. #pragma warning(push) // Saves the current warning state. #pragma warning(disable:4996) // Temporarily disables warning 4996. #endif strncpy(str, String::Format("(Invalid Unicode 0x%X)", code_point).c_str(), 32); -#ifdef GTEST_OS_WINDOWS // We are on Windows. -#pragma warning(pop) // Restores the warning state. +#if GTEST_OS_WINDOWS // We are on Windows. +#pragma warning(pop) // Restores the warning state. #endif str[31] = '\0'; // Makes sure no change in the format to strncpy leaves // the result unterminated. @@ -1592,7 +1592,7 @@ bool String::CaseInsensitiveCStringEquals(const char * lhs, const char * rhs) { if ( rhs == NULL ) return false; -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS return _stricmp(lhs, rhs) == 0; #else // GTEST_OS_WINDOWS return strcasecmp(lhs, rhs) == 0; @@ -1617,9 +1617,9 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs, if ( rhs == NULL ) return false; -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS return _wcsicmp(lhs, rhs) == 0; -#elif defined(GTEST_OS_LINUX) +#elif GTEST_OS_LINUX return wcscasecmp(lhs, rhs) == 0; #else // Mac OS X and Cygwin don't define wcscasecmp. Other unknown OSes @@ -1720,7 +1720,7 @@ String String::Format(const char * format, ...) { char buffer[4096]; // MSVC 8 deprecates vsnprintf(), so we want to suppress warning // 4996 (deprecated function) there. -#ifdef GTEST_OS_WINDOWS // We are on Windows. +#if GTEST_OS_WINDOWS // We are on Windows. #pragma warning(push) // Saves the current warning state. #pragma warning(disable:4996) // Temporarily disables warning 4996. const int size = @@ -1827,7 +1827,7 @@ bool TestResult::ValidateTestProperty(const TestProperty& test_property) { << "Reserved key used in RecordProperty(): " << key << " ('name', 'status', 'time', and 'classname' are reserved by " - << GTEST_NAME << ")"; + << GTEST_NAME_ << ")"; return false; } return true; @@ -1917,7 +1917,7 @@ void Test::RecordProperty(const char* key, int value) { RecordProperty(key, value_message.GetString().c_str()); } -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // We are on Windows. // Adds an "exception thrown" fatal failure to the current test. @@ -2013,7 +2013,7 @@ void Test::Run() { if (!HasSameFixtureClass()) return; internal::UnitTestImpl* const impl = internal::GetUnitTestImpl(); -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // We are on Windows. impl->os_stack_trace_getter()->UponLeavingGTest(); __try { @@ -2122,7 +2122,7 @@ TestInfo* MakeAndRegisterTestInfo( return test_info; } -#ifdef GTEST_HAS_PARAM_TEST +#if GTEST_HAS_PARAM_TEST void ReportInvalidTestCaseType(const char* test_case_name, const char* file, int line) { Message errors; @@ -2221,7 +2221,7 @@ namespace internal { // and INSTANTIATE_TEST_CASE_P into regular tests and registers those. // This will be done just once during the program runtime. void UnitTestImpl::RegisterParameterizedTests() { -#ifdef GTEST_HAS_PARAM_TEST +#if GTEST_HAS_PARAM_TEST if (!parameterized_tests_registered_) { parameterized_test_registry_.RegisterTests(); parameterized_tests_registered_ = true; @@ -2247,7 +2247,7 @@ void TestInfoImpl::Run() { const TimeInMillis start = GetTimeInMillis(); impl->os_stack_trace_getter()->UponLeavingGTest(); -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // We are on Windows. Test* test = NULL; @@ -2459,7 +2459,7 @@ enum GTestColor { COLOR_YELLOW }; -#if defined(GTEST_OS_WINDOWS) && !defined(_WIN32_WCE) +#if GTEST_OS_WINDOWS && !defined(_WIN32_WCE) // Returns the character attribute for the given color. WORD GetColorAttribute(GTestColor color) { @@ -2490,7 +2490,7 @@ bool ShouldUseColor(bool stdout_is_tty) { const char* const gtest_color = GTEST_FLAG(color).c_str(); if (String::CaseInsensitiveCStringEquals(gtest_color, "auto")) { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // On Windows the TERM variable is usually not set, but the // console there does support colors. return stdout_is_tty; @@ -2522,11 +2522,11 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { va_list args; va_start(args, fmt); -#if defined(_WIN32_WCE) || defined(GTEST_OS_SYMBIAN) || defined(GTEST_OS_ZOS) +#if defined(_WIN32_WCE) || GTEST_OS_SYMBIAN || GTEST_OS_ZOS static const bool use_color = false; #else static const bool use_color = ShouldUseColor(isatty(fileno(stdout)) != 0); -#endif // !_WIN32_WCE +#endif // defined(_WIN32_WCE) || GTEST_OS_SYMBIAN || GTEST_OS_ZOS // The '!= 0' comparison is necessary to satisfy MSVC 7.1. if (!use_color) { @@ -2535,7 +2535,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { return; } -#if defined(GTEST_OS_WINDOWS) && !defined(_WIN32_WCE) +#if GTEST_OS_WINDOWS && !defined(_WIN32_WCE) const HANDLE stdout_handle = GetStdHandle(STD_OUTPUT_HANDLE); // Gets the current text color. @@ -2553,7 +2553,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) { printf("\033[0;3%sm", GetAnsiColorCode(color)); vprintf(fmt, args); printf("\033[m"); // Resets the terminal to default. -#endif // GTEST_OS_WINDOWS && !_WIN32_WCE +#endif // GTEST_OS_WINDOWS && !defined(_WIN32_WCE) va_end(args); } @@ -2599,7 +2599,7 @@ void PrettyUnitTestResultPrinter::OnUnitTestStart( // tests may be skipped. if (!internal::String::CStringEquals(filter, kUniversalFilter)) { ColoredPrintf(COLOR_YELLOW, - "Note: %s filter = %s\n", GTEST_NAME, filter); + "Note: %s filter = %s\n", GTEST_NAME_, filter); } if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) { @@ -2926,7 +2926,7 @@ void XmlUnitTestResultPrinter::OnUnitTestEnd(const UnitTest* unit_test) { if (output_dir.CreateDirectoriesRecursively()) { // MSVC 8 deprecates fopen(), so we want to suppress warning 4996 // (deprecated function) there. -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS // We are on Windows. #pragma warning(push) // Saves the current warning state. #pragma warning(disable:4996) // Temporarily disables warning 4996. @@ -3191,7 +3191,7 @@ void OsStackTraceGetter::UponLeavingGTest() { const char* const OsStackTraceGetter::kElidedFramesMarker = - "... " GTEST_NAME " internal frames ..."; + "... " GTEST_NAME_ " internal frames ..."; } // namespace internal @@ -3255,7 +3255,7 @@ void UnitTest::AddTestPartResult(TestPartResultType result_type, internal::MutexLock lock(&mutex_); if (impl_->gtest_trace_stack()->size() > 0) { - msg << "\n" << GTEST_NAME << " trace:"; + msg << "\n" << GTEST_NAME_ << " trace:"; for (internal::ListNode* node = impl_->gtest_trace_stack()->Head(); @@ -3298,7 +3298,7 @@ void UnitTest::RecordPropertyForCurrentTest(const char* key, // We don't protect this under mutex_, as we only support calling it // from the main thread. int UnitTest::Run() { -#ifdef GTEST_OS_WINDOWS +#if GTEST_OS_WINDOWS #if !defined(_WIN32_WCE) // SetErrorMode doesn't exist on CE. @@ -3349,7 +3349,7 @@ const TestInfo* UnitTest::current_test_info() const { return impl_->current_test_info(); } -#ifdef GTEST_HAS_PARAM_TEST +#if GTEST_HAS_PARAM_TEST // Returns ParameterizedTestCaseRegistry object used to keep track of // value-parameterized tests and instantiate and register them. // L < mutex_ @@ -3404,7 +3404,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent) per_thread_test_part_result_reporter_( &default_per_thread_test_part_result_reporter_), test_cases_(), -#ifdef GTEST_HAS_PARAM_TEST +#if GTEST_HAS_PARAM_TEST parameterized_test_registry_(), parameterized_tests_registered_(false), #endif // GTEST_HAS_PARAM_TEST @@ -3414,7 +3414,7 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent) ad_hoc_test_result_(), result_printer_(NULL), os_stack_trace_getter_(NULL), -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST elapsed_time_(0), internal_run_death_test_flag_(NULL), death_test_factory_(new DefaultDeathTestFactory) { @@ -3540,7 +3540,7 @@ int UnitTestImpl::RunAllTests() { // death test. bool in_subprocess_for_death_test = false; -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST internal_run_death_test_flag_.reset(ParseInternalRunDeathTestFlag()); in_subprocess_for_death_test = (internal_run_death_test_flag_.get() != NULL); #endif // GTEST_HAS_DEATH_TEST @@ -3817,7 +3817,7 @@ UnitTestEventListenerInterface* UnitTestImpl::result_printer() { return result_printer_; } -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST if (internal_run_death_test_flag_.get() != NULL) { result_printer_ = new NullUnitTestResultPrinter; return result_printer_; @@ -3943,8 +3943,8 @@ const char* ParseFlagValue(const char* str, // str and flag must not be NULL. if (str == NULL || flag == NULL) return NULL; - // The flag must start with "--" followed by GTEST_FLAG_PREFIX. - const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX, flag); + // The flag must start with "--" followed by GTEST_FLAG_PREFIX_. + const String flag_str = String::Format("--%s%s", GTEST_FLAG_PREFIX_, flag); const size_t flag_len = flag_str.GetLength(); if (strncmp(str, flag_str.c_str(), flag_len) != 0) return NULL; @@ -4096,7 +4096,7 @@ void InitGoogleTestImpl(int* argc, CharType** argv) { internal::g_executable_path = internal::StreamableToString(argv[0]); -#ifdef GTEST_HAS_DEATH_TEST +#if GTEST_HAS_DEATH_TEST g_argvs.clear(); for (int i = 0; i != *argc; i++) { g_argvs.push_back(StreamableToString(argv[i])); -- cgit v1.2.3