aboutsummaryrefslogtreecommitdiff
path: root/src/gtest
diff options
context:
space:
mode:
Diffstat (limited to 'src/gtest')
-rw-r--r--src/gtest/gtest.cc43
-rw-r--r--src/gtest/internal/gtest-internal.h12
-rw-r--r--src/gtest/internal/gtest-port.h6
3 files changed, 27 insertions, 34 deletions
diff --git a/src/gtest/gtest.cc b/src/gtest/gtest.cc
index 1eee3922..09a0815a 100644
--- a/src/gtest/gtest.cc
+++ b/src/gtest/gtest.cc
@@ -112,6 +112,21 @@
namespace testing {
+// Calling ForEach(internal::Delete<T>) doesn't work on HP C++ / Tru64. So,
+// we must define a separate non-template function for each type.
+static void DeleteTestCase(TestCase *x)
+{
+ delete x;
+}
+static void DeleteEnvironment(Environment *x)
+{
+ delete x;
+}
+static void DeleteTestInfo(TestInfo *x)
+{
+ delete x;
+}
+
// Constants.
// A test that matches this pattern is disabled and not run.
@@ -799,28 +814,6 @@ String FormatForFailureMessage(char ch) {
ch_as_uint, ch_as_uint);
}
-// For a wchar_t value, we print it as a C++ wchar_t literal and as an
-// unsigned integer (both in decimal and in hexidecimal).
-String FormatForFailureMessage(wchar_t wchar) {
- // The C++ standard doesn't specify the exact size of the wchar_t
- // type. It just says that it shall have the same size as another
- // integral type, called its underlying type.
- //
- // Therefore, in order to print a wchar_t value in the numeric form,
- // we first convert it to the largest integral type (UInt64) and
- // then print the converted value.
- //
- // We use streaming to print the value as "%llu" doesn't work
- // correctly with MSVC 7.1.
- const UInt64 wchar_as_uint64 = wchar;
- Message msg;
- // A String object cannot contain '\0', so we print "\\0" when wchar is
- // L'\0'.
- msg << "L'" << (wchar ? ToUtf8String(wchar).c_str() : "\\0") << "' ("
- << wchar_as_uint64 << ", 0x" << ::std::setbase(16)
- << wchar_as_uint64 << ")";
- return msg.GetString();
-}
} // namespace internal
@@ -2059,7 +2052,7 @@ TestCase::TestCase(const char* name,
// Destructor of TestCase.
TestCase::~TestCase() {
// Deletes every Test in the collection.
- test_info_list_->ForEach(internal::Delete<TestInfo>);
+ test_info_list_->ForEach(DeleteTestInfo);
// Then deletes the Test collection.
delete test_info_list_;
@@ -3039,10 +3032,10 @@ UnitTestImpl::UnitTestImpl(UnitTest* parent)
UnitTestImpl::~UnitTestImpl() {
// Deletes every TestCase.
- test_cases_.ForEach(internal::Delete<TestCase>);
+ test_cases_.ForEach(DeleteTestCase);
// Deletes every Environment.
- environments_.ForEach(internal::Delete<Environment>);
+ environments_.ForEach(DeleteEnvironment);
// Deletes the current test result printer.
delete result_printer_;
diff --git a/src/gtest/internal/gtest-internal.h b/src/gtest/internal/gtest-internal.h
index 2be1b4ac..883981f6 100644
--- a/src/gtest/internal/gtest-internal.h
+++ b/src/gtest/internal/gtest-internal.h
@@ -210,12 +210,13 @@ String StreamableToString(const T& streamable);
// Formats a value to be used in a failure message.
-#ifdef __SYMBIAN32__
+#if defined (__SYMBIAN32__) || (defined (__DECCXX) && defined(__osf__))
-// These are needed as the Nokia Symbian Compiler cannot decide between
-// const T& and const T* in a function template. The Nokia compiler _can_
-// decide between class template specializations for T and T*, so a
-// tr1::type_traits-like is_pointer works, and we can overload on that.
+// These are needed as the Nokia Symbian Compiler and HP C++ on Tru64
+// cannot decide between const T& and const T* in a function template.
+// These compliers _can_ decide between class template specializations
+// for T and T*, so a tr1::type_traits-like is_pointer works, and we
+// can overload on that.
// This overload makes sure that all pointers (including
// those to char or wchar_t) are printed as raw pointers.
@@ -255,7 +256,6 @@ inline String FormatForFailureMessage(T* pointer) {
// These overloaded versions handle narrow and wide characters.
String FormatForFailureMessage(char ch);
-String FormatForFailureMessage(wchar_t wchar);
// When this operand is a const char* or char*, and the other operand
// is a ::std::string or ::string, we print this operand as a C string
diff --git a/src/gtest/internal/gtest-port.h b/src/gtest/internal/gtest-port.h
index 36d5a149..9d65ec83 100644
--- a/src/gtest/internal/gtest-port.h
+++ b/src/gtest/internal/gtest-port.h
@@ -223,10 +223,10 @@
// struct Foo {
// Foo() { ... }
// } GTEST_ATTRIBUTE_UNUSED;
-#if defined(GTEST_OS_WINDOWS) || (defined(GTEST_OS_LINUX) && defined(SWIG))
-#define GTEST_ATTRIBUTE_UNUSED
-#else
+#ifdef __GNUC__
#define GTEST_ATTRIBUTE_UNUSED __attribute__ ((unused))
+#else
+#define GTEST_ATTRIBUTE_UNUSED
#endif // GTEST_OS_WINDOWS || (GTEST_OS_LINUX && SWIG)
// A macro to disallow the evil copy constructor and operator= functions