diff options
Diffstat (limited to 'include/gtest/internal')
| -rw-r--r-- | include/gtest/internal/gtest-death-test-internal.h | 20 | ||||
| -rw-r--r-- | include/gtest/internal/gtest-internal.h | 105 | ||||
| -rw-r--r-- | include/gtest/internal/gtest-port.h | 86 | 
3 files changed, 126 insertions, 85 deletions
| diff --git a/include/gtest/internal/gtest-death-test-internal.h b/include/gtest/internal/gtest-death-test-internal.h index b49c6e47..0769fcaa 100644 --- a/include/gtest/internal/gtest-death-test-internal.h +++ b/include/gtest/internal/gtest-death-test-internal.h @@ -42,7 +42,7 @@  namespace testing {  namespace internal { -GTEST_DECLARE_string(internal_run_death_test); +GTEST_DECLARE_string_(internal_run_death_test);  // Names of the flags (needed for parsing Google Test flags).  const char kDeathTestStyleFlag[] = "death_test_style"; @@ -51,7 +51,7 @@ const char kInternalRunDeathTestFlag[] = "internal_run_death_test";  #ifdef GTEST_HAS_DEATH_TEST  // DeathTest is a class that hides much of the complexity of the -// GTEST_DEATH_TEST macro.  It is abstract; its static Create method +// GTEST_DEATH_TEST_ macro.  It is abstract; its static Create method  // returns a concrete class that depends on the prevailing death test  // style, as defined by the --gtest_death_test_style and/or  // --gtest_internal_run_death_test flags. @@ -85,8 +85,8 @@ class DeathTest {      ~ReturnSentinel() { test_->Abort(TEST_ENCOUNTERED_RETURN_STATEMENT); }     private:      DeathTest* const test_; -    GTEST_DISALLOW_COPY_AND_ASSIGN(ReturnSentinel); -  } GTEST_ATTRIBUTE_UNUSED; +    GTEST_DISALLOW_COPY_AND_ASSIGN_(ReturnSentinel); +  } GTEST_ATTRIBUTE_UNUSED_;    // An enumeration of possible roles that may be taken when a death    // test is encountered.  EXECUTE means that the death test logic should @@ -121,7 +121,7 @@ class DeathTest {    static const char* LastMessage();   private: -  GTEST_DISALLOW_COPY_AND_ASSIGN(DeathTest); +  GTEST_DISALLOW_COPY_AND_ASSIGN_(DeathTest);  };  // Factory interface for death tests.  May be mocked out for testing. @@ -145,14 +145,14 @@ bool ExitedUnsuccessfully(int exit_status);  // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*,  // ASSERT_EXIT*, and EXPECT_EXIT*. -#define GTEST_DEATH_TEST(statement, predicate, regex, fail) \ -  GTEST_AMBIGUOUS_ELSE_BLOCKER \ +#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \ +  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \    if (true) { \      const ::testing::internal::RE& gtest_regex = (regex); \      ::testing::internal::DeathTest* gtest_dt; \      if (!::testing::internal::DeathTest::Create(#statement, >est_regex, \          __FILE__, __LINE__, >est_dt)) { \ -      goto GTEST_CONCAT_TOKEN(gtest_label_, __LINE__); \ +      goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \      } \      if (gtest_dt != NULL) { \        ::testing::internal::scoped_ptr< ::testing::internal::DeathTest> \ @@ -160,7 +160,7 @@ bool ExitedUnsuccessfully(int exit_status);        switch (gtest_dt->AssumeRole()) { \          case ::testing::internal::DeathTest::OVERSEE_TEST: \            if (!gtest_dt->Passed(predicate(gtest_dt->Wait()))) { \ -            goto GTEST_CONCAT_TOKEN(gtest_label_, __LINE__); \ +            goto GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__); \            } \            break; \          case ::testing::internal::DeathTest::EXECUTE_TEST: { \ @@ -173,7 +173,7 @@ bool ExitedUnsuccessfully(int exit_status);        } \      } \    } else \ -    GTEST_CONCAT_TOKEN(gtest_label_, __LINE__): \ +    GTEST_CONCAT_TOKEN_(gtest_label_, __LINE__): \        fail(::testing::internal::DeathTest::LastMessage())  // The symbol "fail" here expands to something into which a message  // can be streamed. diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 898047e8..7128a51d 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -64,8 +64,8 @@  // will result in the token foo__LINE__, instead of foo followed by  // the current line number.  For more details, see  // http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.6 -#define GTEST_CONCAT_TOKEN(foo, bar) GTEST_CONCAT_TOKEN_IMPL(foo, bar) -#define GTEST_CONCAT_TOKEN_IMPL(foo, bar) foo ## bar +#define GTEST_CONCAT_TOKEN_(foo, bar) GTEST_CONCAT_TOKEN_IMPL_(foo, bar) +#define GTEST_CONCAT_TOKEN_IMPL_(foo, bar) foo ## bar  // Google Test defines the testing::Message class to allow construction of  // test messages via the << operator.  The idea is that anything @@ -121,6 +121,10 @@ class UnitTestImpl;                    // Opaque implementation of UnitTest  template <typename E> class List;      // A generic list.  template <typename E> class ListNode;  // A node in a generic list. +// The text used in failure messages to indicate the start of the +// stack trace. +extern const char kStackTraceMarker[]; +  // A secret type that Google Test users don't know about.  It has no  // definition on purpose.  Therefore it's impossible to create a  // Secret object, which is what we want. @@ -151,11 +155,11 @@ char (&IsNullLiteralHelper(...))[2];  // NOLINT  // The Nokia Symbian compiler tries to instantiate a copy constructor for  // objects passed through ellipsis (...), failing for uncopyable objects.  // Hence we define this to false (and lose support for NULL detection). -#define GTEST_IS_NULL_LITERAL(x) false -#else  // ! __SYMBIAN32__ -#define GTEST_IS_NULL_LITERAL(x) \ +#define GTEST_IS_NULL_LITERAL_(x) false +#else  // ! GTEST_OS_SYMBIAN +#define GTEST_IS_NULL_LITERAL_(x) \      (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) -#endif  // __SYMBIAN32__ +#endif  // GTEST_OS_SYMBIAN  // Appends the user-supplied message to the Google-Test-generated message.  String AppendUserMessage(const String& gtest_msg, @@ -175,10 +179,10 @@ class ScopedTrace {    ~ScopedTrace();   private: -  GTEST_DISALLOW_COPY_AND_ASSIGN(ScopedTrace); -} GTEST_ATTRIBUTE_UNUSED;  // A ScopedTrace object does its job in its -                           // c'tor and d'tor.  Therefore it doesn't -                           // need to be used otherwise. +  GTEST_DISALLOW_COPY_AND_ASSIGN_(ScopedTrace); +} GTEST_ATTRIBUTE_UNUSED_;  // A ScopedTrace object does its job in its +                            // c'tor and d'tor.  Therefore it doesn't +                            // need to be used otherwise.  // Converts a streamable value to a String.  A NULL pointer is  // converted to "(null)".  When the input value is a ::string, @@ -192,7 +196,7 @@ String StreamableToString(const T& streamable);  // Formats a value to be used in a failure message. -#ifdef __SYMBIAN32__ +#ifdef GTEST_OS_SYMBIAN  // These are needed as the Nokia Symbian Compiler cannot decide between  // const T& and const T* in a function template. The Nokia compiler _can_ @@ -233,7 +237,7 @@ inline String FormatForFailureMessage(T* pointer) {    return StreamableToString(static_cast<const void*>(pointer));  } -#endif  // __SYMBIAN32__ +#endif  // GTEST_OS_SYMBIAN  // These overloaded versions handle narrow and wide characters.  String FormatForFailureMessage(char ch); @@ -244,7 +248,7 @@ String FormatForFailureMessage(wchar_t wchar);  // rather than a pointer.  We do the same for wide strings.  // This internal macro is used to avoid duplicated code. -#define GTEST_FORMAT_IMPL(operand2_type, operand1_printer)\ +#define GTEST_FORMAT_IMPL_(operand2_type, operand1_printer)\  inline String FormatForComparisonFailureMessage(\      operand2_type::value_type* str, const operand2_type& /*operand2*/) {\    return operand1_printer(str);\ @@ -255,20 +259,20 @@ inline String FormatForComparisonFailureMessage(\  }  #if GTEST_HAS_STD_STRING -GTEST_FORMAT_IMPL(::std::string, String::ShowCStringQuoted) +GTEST_FORMAT_IMPL_(::std::string, String::ShowCStringQuoted)  #endif  // GTEST_HAS_STD_STRING  #if GTEST_HAS_STD_WSTRING -GTEST_FORMAT_IMPL(::std::wstring, String::ShowWideCStringQuoted) +GTEST_FORMAT_IMPL_(::std::wstring, String::ShowWideCStringQuoted)  #endif  // GTEST_HAS_STD_WSTRING  #if GTEST_HAS_GLOBAL_STRING -GTEST_FORMAT_IMPL(::string, String::ShowCStringQuoted) +GTEST_FORMAT_IMPL_(::string, String::ShowCStringQuoted)  #endif  // GTEST_HAS_GLOBAL_STRING  #if GTEST_HAS_GLOBAL_WSTRING -GTEST_FORMAT_IMPL(::wstring, String::ShowWideCStringQuoted) +GTEST_FORMAT_IMPL_(::wstring, String::ShowWideCStringQuoted)  #endif  // GTEST_HAS_GLOBAL_WSTRING -#undef GTEST_FORMAT_IMPL +#undef GTEST_FORMAT_IMPL_  // Constructs and returns the message for an equality assertion  // (e.g. ASSERT_EQ, EXPECT_STREQ, etc) failure. @@ -503,7 +507,7 @@ class TestFactoryBase {    TestFactoryBase() {}   private: -  GTEST_DISALLOW_COPY_AND_ASSIGN(TestFactoryBase); +  GTEST_DISALLOW_COPY_AND_ASSIGN_(TestFactoryBase);  };  // This class provides implementation of TeastFactoryBase interface. @@ -704,22 +708,22 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {  }  // namespace internal  }  // namespace testing -#define GTEST_MESSAGE(message, result_type) \ +#define GTEST_MESSAGE_(message, result_type) \    ::testing::internal::AssertHelper(result_type, __FILE__, __LINE__, message) \      = ::testing::Message() -#define GTEST_FATAL_FAILURE(message) \ -  return GTEST_MESSAGE(message, ::testing::TPRT_FATAL_FAILURE) +#define GTEST_FATAL_FAILURE_(message) \ +  return GTEST_MESSAGE_(message, ::testing::TPRT_FATAL_FAILURE) -#define GTEST_NONFATAL_FAILURE(message) \ -  GTEST_MESSAGE(message, ::testing::TPRT_NONFATAL_FAILURE) +#define GTEST_NONFATAL_FAILURE_(message) \ +  GTEST_MESSAGE_(message, ::testing::TPRT_NONFATAL_FAILURE) -#define GTEST_SUCCESS(message) \ -  GTEST_MESSAGE(message, ::testing::TPRT_SUCCESS) +#define GTEST_SUCCESS_(message) \ +  GTEST_MESSAGE_(message, ::testing::TPRT_SUCCESS) -#define GTEST_TEST_THROW(statement, expected_exception, fail) \ -  GTEST_AMBIGUOUS_ELSE_BLOCKER \ +#define GTEST_TEST_THROW_(statement, expected_exception, fail) \ +  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \    if (const char* gtest_msg = "") { \      bool gtest_caught_expected = false; \      try { \ @@ -732,19 +736,19 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {        gtest_msg = "Expected: " #statement " throws an exception of type " \                    #expected_exception ".\n  Actual: it throws a different " \                    "type."; \ -      goto GTEST_CONCAT_TOKEN(gtest_label_testthrow_, __LINE__); \ +      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \      } \      if (!gtest_caught_expected) { \        gtest_msg = "Expected: " #statement " throws an exception of type " \                    #expected_exception ".\n  Actual: it throws nothing."; \ -      goto GTEST_CONCAT_TOKEN(gtest_label_testthrow_, __LINE__); \ +      goto GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__); \      } \    } else \ -    GTEST_CONCAT_TOKEN(gtest_label_testthrow_, __LINE__): \ +    GTEST_CONCAT_TOKEN_(gtest_label_testthrow_, __LINE__): \        fail(gtest_msg) -#define GTEST_TEST_NO_THROW(statement, fail) \ -  GTEST_AMBIGUOUS_ELSE_BLOCKER \ +#define GTEST_TEST_NO_THROW_(statement, fail) \ +  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \    if (const char* gtest_msg = "") { \      try { \        statement; \ @@ -752,14 +756,14 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {      catch (...) { \        gtest_msg = "Expected: " #statement " doesn't throw an exception.\n" \                    "  Actual: it throws."; \ -      goto GTEST_CONCAT_TOKEN(gtest_label_testnothrow_, __LINE__); \ +      goto GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__); \      } \    } else \ -    GTEST_CONCAT_TOKEN(gtest_label_testnothrow_, __LINE__): \ +    GTEST_CONCAT_TOKEN_(gtest_label_testnothrow_, __LINE__): \        fail(gtest_msg) -#define GTEST_TEST_ANY_THROW(statement, fail) \ -  GTEST_AMBIGUOUS_ELSE_BLOCKER \ +#define GTEST_TEST_ANY_THROW_(statement, fail) \ +  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \    if (const char* gtest_msg = "") { \      bool gtest_caught_any = false; \      try { \ @@ -771,33 +775,48 @@ class TypeParameterizedTestCase<Fixture, Templates0, Types> {      if (!gtest_caught_any) { \        gtest_msg = "Expected: " #statement " throws an exception.\n" \                    "  Actual: it doesn't."; \ -      goto GTEST_CONCAT_TOKEN(gtest_label_testanythrow_, __LINE__); \ +      goto GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__); \      } \    } else \ -    GTEST_CONCAT_TOKEN(gtest_label_testanythrow_, __LINE__): \ +    GTEST_CONCAT_TOKEN_(gtest_label_testanythrow_, __LINE__): \        fail(gtest_msg) -#define GTEST_TEST_BOOLEAN(boolexpr, booltext, actual, expected, fail) \ -  GTEST_AMBIGUOUS_ELSE_BLOCKER \ +#define GTEST_TEST_BOOLEAN_(boolexpr, booltext, actual, expected, fail) \ +  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \    if (boolexpr) \      ; \    else \      fail("Value of: " booltext "\n  Actual: " #actual "\nExpected: " #expected) +#define GTEST_TEST_NO_FATAL_FAILURE_(statement, fail) \ +  GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ +  if (const char* gtest_msg = "") { \ +    ::testing::internal::HasNewFatalFailureHelper gtest_fatal_failure_checker; \ +    { statement; } \ +    if (gtest_fatal_failure_checker.has_new_fatal_failure()) { \ +      gtest_msg = "Expected: " #statement " doesn't generate new fatal " \ +                  "failures in the current thread.\n" \ +                  "  Actual: it does."; \ +      goto GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__); \ +    } \ +  } else \ +    GTEST_CONCAT_TOKEN_(gtest_label_testnofatal_, __LINE__): \ +      fail(gtest_msg) +  // Expands to the name of the class that implements the given test.  #define GTEST_TEST_CLASS_NAME_(test_case_name, test_name) \    test_case_name##_##test_name##_Test  // Helper macro for defining tests. -#define GTEST_TEST(test_case_name, test_name, parent_class)\ +#define GTEST_TEST_(test_case_name, test_name, parent_class)\  class GTEST_TEST_CLASS_NAME_(test_case_name, test_name) : public parent_class {\   public:\    GTEST_TEST_CLASS_NAME_(test_case_name, test_name)() {}\   private:\    virtual void TestBody();\    static ::testing::TestInfo* const test_info_;\ -  GTEST_DISALLOW_COPY_AND_ASSIGN(\ +  GTEST_DISALLOW_COPY_AND_ASSIGN_(\        GTEST_TEST_CLASS_NAME_(test_case_name, test_name));\  };\  \ diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 022e6706..1363b2c3 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -37,27 +37,25 @@  #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_PORT_H_  // The user can define the following macros in the build script to -// control Google Test's behavior: +// control Google Test's behavior.  If the user doesn't define a macro +// in this list, Google Test will define it.  //  //   GTEST_HAS_STD_STRING     - Define it to 1/0 to indicate that  //                              std::string does/doesn't work (Google Test can  //                              be used where std::string is unavailable). -//                              Leave it undefined to let Google Test define it.  //   GTEST_HAS_GLOBAL_STRING  - Define it to 1/0 to indicate that ::string  //                              is/isn't available (some systems define  //                              ::string, which is different to std::string). -//                              Leave it undefined to let Google Test define it.  //   GTEST_HAS_STD_WSTRING    - Define it to 1/0 to indicate that  //                              std::wstring does/doesn't work (Google Test can  //                              be used where std::wstring is unavailable). -//                              Leave it undefined to let Google Test define it.  //   GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string  //                              is/isn't available (some systems define  //                              ::wstring, which is different to std::wstring). -//                              Leave it undefined to let Google Test define it.  //   GTEST_HAS_RTTI           - Define it to 1/0 to indicate that RTTI is/isn't -//                              enabled.  Leave it undefined to let Google -//                              Test define it. +//                              enabled. +//   GTEST_HAS_PTHREAD        - Define it to 1/0 to indicate that <pthread.h> +//                              is/isn't available.  // This header defines the following utilities:  // @@ -72,6 +70,7 @@  //   GTEST_OS_CYGWIN   - defined iff compiled on Cygwin.  //   GTEST_OS_LINUX    - defined iff compiled on Linux.  //   GTEST_OS_MAC      - defined iff compiled on Mac OS X. +//   GTEST_OS_SYMBIAN  - defined iff compiled for Symbian.  //   GTEST_OS_WINDOWS  - defined iff compiled on Windows.  // Note that it is possible that none of the GTEST_OS_ macros are defined.  // @@ -82,15 +81,18 @@  //                            supported.  //  // Macros for basic C++ coding: -//   GTEST_AMBIGUOUS_ELSE_BLOCKER - for disabling a gcc warning. -//   GTEST_ATTRIBUTE_UNUSED  - declares that a class' instances don't have to -//                             be used. -//   GTEST_DISALLOW_COPY_AND_ASSIGN()  - disables copy ctor and operator=. -//   GTEST_MUST_USE_RESULT   - declares that a function's result must be used. +//   GTEST_AMBIGUOUS_ELSE_BLOCKER_ - for disabling a gcc warning. +//   GTEST_ATTRIBUTE_UNUSED_  - declares that a class' instances don't have to +//                              be used. +//   GTEST_DISALLOW_COPY_AND_ASSIGN_ - disables copy ctor and operator=. +//   GTEST_MUST_USE_RESULT_   - declares that a function's result must be used.  //  // Synchronization:  //   Mutex, MutexLock, ThreadLocal, GetThreadCount()  //                  - synchronization primitives. +//   GTEST_IS_THREADSAFE - defined to 1 to indicate that the above +//                         synchronization primitives have real implementations +//                         and Google Test is thread-safe; or 0 otherwise.  //  // Template meta programming:  //   is_pointer     - as in TR1; needed on Symbian only. @@ -104,7 +106,7 @@  //                    Windows.  //  // Logging: -//   GTEST_LOG()    - logs messages at the specified severity level. +//   GTEST_LOG_()   - logs messages at the specified severity level.  //   LogToStderr()  - directs all log messages to stderr.  //   FlushInfoLog() - flushes informational log messages.  // @@ -148,6 +150,8 @@  // Determines the platform on which Google Test is compiled.  #ifdef __CYGWIN__  #define GTEST_OS_CYGWIN +#elif __SYMBIAN32__ +#define GTEST_OS_SYMBIAN  #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 @@ -261,6 +265,18 @@  #endif  // GTEST_HAS_RTTI +// Determines whether <pthread.h> is available. +#ifndef GTEST_HAS_PTHREAD +// The user didn't tell us, so we need to figure it out. + +#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC) +#define GTEST_HAS_PTHREAD 1 +#else +#define GTEST_HAS_PTHREAD 0 +#endif  // GTEST_OS_LINUX || GTEST_OS_MAC + +#endif  // GTEST_HAS_PTHREAD +  // Determines whether to support death tests.  #if GTEST_HAS_STD_STRING && defined(GTEST_OS_LINUX)  #define GTEST_HAS_DEATH_TEST @@ -285,7 +301,7 @@  // Determines whether the system compiler uses UTF-16 for encoding wide strings.  #if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \ -        defined(__SYMBIAN32__) +        defined(GTEST_OS_SYMBIAN)  #define GTEST_WIDE_STRING_USES_UTF16_ 1  #endif @@ -300,9 +316,9 @@  //  // The "switch (0) case 0:" idiom is used to suppress this.  #ifdef __INTEL_COMPILER -#define GTEST_AMBIGUOUS_ELSE_BLOCKER +#define GTEST_AMBIGUOUS_ELSE_BLOCKER_  #else -#define GTEST_AMBIGUOUS_ELSE_BLOCKER switch (0) case 0:  // NOLINT +#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0:  // NOLINT  #endif  // Use this annotation at the end of a struct / class definition to @@ -312,16 +328,16 @@  //  //   struct Foo {  //     Foo() { ... } -//   } GTEST_ATTRIBUTE_UNUSED; +//   } GTEST_ATTRIBUTE_UNUSED_;  #if defined(__GNUC__) && !defined(COMPILER_ICC) -#define GTEST_ATTRIBUTE_UNUSED __attribute__ ((unused)) +#define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused))  #else -#define GTEST_ATTRIBUTE_UNUSED +#define GTEST_ATTRIBUTE_UNUSED_  #endif  // A macro to disallow the evil copy constructor and operator= functions  // This should be used in the private: declarations for a class. -#define GTEST_DISALLOW_COPY_AND_ASSIGN(type)\ +#define GTEST_DISALLOW_COPY_AND_ASSIGN_(type)\    type(const type &);\    void operator=(const type &) @@ -329,11 +345,11 @@  // with this macro.  The macro should be used on function declarations  // following the argument list:  // -//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT; +//   Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_;  #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC) -#define GTEST_MUST_USE_RESULT __attribute__ ((warn_unused_result)) +#define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result))  #else -#define GTEST_MUST_USE_RESULT +#define GTEST_MUST_USE_RESULT_  #endif  // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC  namespace testing { @@ -385,7 +401,7 @@ class scoped_ptr {   private:    T* ptr_; -  GTEST_DISALLOW_COPY_AND_ASSIGN(scoped_ptr); +  GTEST_DISALLOW_COPY_AND_ASSIGN_(scoped_ptr);  };  #ifdef GTEST_HAS_DEATH_TEST @@ -444,7 +460,7 @@ class RE {  #endif  // GTEST_HAS_DEATH_TEST  // Defines logging utilities: -//   GTEST_LOG()    - logs messages at the specified severity level. +//   GTEST_LOG_()   - logs messages at the specified severity level.  //   LogToStderr()  - directs all log messages to stderr.  //   FlushInfoLog() - flushes informational log messages. @@ -458,7 +474,7 @@ enum GTestLogSeverity {  void GTestLog(GTestLogSeverity severity, const char* file,                int line, const char* msg); -#define GTEST_LOG(severity, msg)\ +#define GTEST_LOG_(severity, msg)\      ::testing::internal::GTestLog(\          ::testing::internal::GTEST_##severity, __FILE__, __LINE__, \          (::testing::Message() << (msg)).GetString().c_str()) @@ -510,6 +526,8 @@ typedef GTestMutexLock MutexLock;  template <typename T>  class ThreadLocal {   public: +  ThreadLocal() : value_() {} +  explicit ThreadLocal(const T& value) : value_(value) {}    T* pointer() { return &value_; }    const T* pointer() const { return &value_; }    const T& get() const { return value_; } @@ -522,6 +540,10 @@ class ThreadLocal {  // return 0 to indicate that we cannot detect it.  inline size_t GetThreadCount() { return 0; } +// The above synchronization primitives have dummy implementations. +// Therefore Google Test is not thread-safe. +#define GTEST_IS_THREADSAFE 0 +  // Defines tr1::is_pointer (only needed for Symbian).  #ifdef __SYMBIAN32__ @@ -657,18 +679,18 @@ inline void abort() { ::abort(); }  #define GTEST_FLAG(name) FLAGS_gtest_##name  // Macros for declaring flags. -#define GTEST_DECLARE_bool(name) extern bool GTEST_FLAG(name) -#define GTEST_DECLARE_int32(name) \ +#define GTEST_DECLARE_bool_(name) extern bool GTEST_FLAG(name) +#define GTEST_DECLARE_int32_(name) \      extern ::testing::internal::Int32 GTEST_FLAG(name) -#define GTEST_DECLARE_string(name) \ +#define GTEST_DECLARE_string_(name) \      extern ::testing::internal::String GTEST_FLAG(name)  // Macros for defining flags. -#define GTEST_DEFINE_bool(name, default_val, doc) \ +#define GTEST_DEFINE_bool_(name, default_val, doc) \      bool GTEST_FLAG(name) = (default_val) -#define GTEST_DEFINE_int32(name, default_val, doc) \ +#define GTEST_DEFINE_int32_(name, default_val, doc) \      ::testing::internal::Int32 GTEST_FLAG(name) = (default_val) -#define GTEST_DEFINE_string(name, default_val, doc) \ +#define GTEST_DEFINE_string_(name, default_val, doc) \      ::testing::internal::String GTEST_FLAG(name) = (default_val)  // Parses 'str' for a 32-bit signed integer.  If successful, writes the result | 
