diff options
author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-12-07 20:45:16 (GMT) |
---|---|---|
committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2009-12-07 20:45:16 (GMT) |
commit | 44bafcb62d0f33fbc9aafb5492b245c949850df8 (patch) | |
tree | c5e5ca98647e5fe261104e21c07e8beb02d300ff /include | |
parent | 891b3716c4b6e4bd7fdbd642ecaab37776eb5935 (diff) | |
download | googletest-44bafcb62d0f33fbc9aafb5492b245c949850df8.zip googletest-44bafcb62d0f33fbc9aafb5492b245c949850df8.tar.gz googletest-44bafcb62d0f33fbc9aafb5492b245c949850df8.tar.bz2 |
Fixes the "passing non-POD to ellipsis" warning in Sun Studio. Based on Alexander Demin's patch.
Diffstat (limited to 'include')
-rw-r--r-- | include/gtest/internal/gtest-internal.h | 11 | ||||
-rw-r--r-- | include/gtest/internal/gtest-port.h | 19 |
2 files changed, 14 insertions, 16 deletions
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 43e5f97..e9f8e7c 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -148,17 +148,14 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT // A compile-time bool constant that is true if and only if x is a // null pointer literal (i.e. NULL or any 0-valued compile-time // integral constant). -#ifdef GTEST_ELLIPSIS_NEEDS_COPY_ -// Passing non-POD classes through ellipsis (...) crashes the ARM -// compiler. The Nokia Symbian and the IBM XL C/C++ compiler try 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). +#ifdef GTEST_ELLIPSIS_NEEDS_POD_ +// We lose support for NULL detection where the compiler doesn't like +// passing non-POD classes through ellipsis (...). #define GTEST_IS_NULL_LITERAL_(x) false #else #define GTEST_IS_NULL_LITERAL_(x) \ (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) -#endif // GTEST_ELLIPSIS_NEEDS_COPY_ +#endif // GTEST_ELLIPSIS_NEEDS_POD_ // Appends the user-supplied message to the Google-Test-generated message. String AppendUserMessage(const String& gtest_msg, diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index c67fbd3..603e7f1 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -787,22 +787,23 @@ size_t GetThreadCount(); // Therefore Google Test is not thread-safe. #define GTEST_IS_THREADSAFE 0 -#if defined(__SYMBIAN32__) || defined(__IBMCPP__) - // Passing non-POD classes through ellipsis (...) crashes the ARM -// compiler. The Nokia Symbian and the IBM XL C/C++ compiler try to -// instantiate a copy constructor for objects passed through ellipsis -// (...), failing for uncopyable objects. We define this to indicate -// the fact. -#define GTEST_ELLIPSIS_NEEDS_COPY_ 1 +// compiler and generates a warning in Sun Studio. The Nokia Symbian +// and the IBM XL C/C++ compiler try to instantiate a copy constructor +// for objects passed through ellipsis (...), failing for uncopyable +// objects. We define this to ensure that only POD is passed through +// ellipsis on these systems. +#if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) +#define GTEST_ELLIPSIS_NEEDS_POD_ 1 +#endif // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between // const T& and const T* in a function template. These compilers // _can_ decide between class template specializations for T and T*, // so a tr1::type_traits-like is_pointer works. +#if defined(__SYMBIAN32__) || defined(__IBMCPP__) #define GTEST_NEEDS_IS_POINTER_ 1 - -#endif // defined(__SYMBIAN32__) || defined(__IBMCPP__) +#endif template <bool bool_value> struct bool_constant { |