summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-03-11 23:05:00 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2011-03-11 23:05:00 +0000
commit585ec31ea716f08233a815e680fc0d4699843938 (patch)
tree855028aed973341aa041ee2468a0bd5293853616
parent6c5116014ce51ef3273d800cbf75fcef99e798c6 (diff)
downloadgoogletest-585ec31ea716f08233a815e680fc0d4699843938.tar.gz
Fixes compatibility with Sun C++ (by Hady Zalek); fixes compatibility
with Android (by Zachary Vorhies). git-svn-id: http://googletest.googlecode.com/svn/trunk@555 861a406c-534a-0410-8894-cb66d6ee9925
-rw-r--r--include/gtest/internal/gtest-internal.h12
-rw-r--r--include/gtest/internal/gtest-port.h10
-rw-r--r--src/gtest.cc6
3 files changed, 17 insertions, 11 deletions
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h
index cfa3885..fcf4c71 100644
--- a/include/gtest/internal/gtest-internal.h
+++ b/include/gtest/internal/gtest-internal.h
@@ -788,16 +788,16 @@ struct RemoveConst { typedef T type; }; // NOLINT
template <typename T>
struct RemoveConst<const T> { typedef T type; }; // NOLINT
-// MSVC 8.0 has a bug which causes the above definition to fail to
-// remove the const in 'const int[3]'. The following specialization
-// works around the bug. However, it causes trouble with gcc and thus
-// needs to be conditionally compiled.
-#ifdef _MSC_VER
+// MSVC 8.0 and Sun C++ have a bug which causes the above definition
+// to fail to remove the const in 'const int[3]'. The following
+// specialization works around the bug. However, it causes trouble
+// with GCC and thus needs to be conditionally compiled.
+#if defined(_MSC_VER) || defined(__SUNPRO_CC)
template <typename T, size_t N>
struct RemoveConst<T[N]> {
typedef typename RemoveConst<T>::type type[N];
};
-#endif // _MSC_VER
+#endif
// A handy wrapper around RemoveConst that works when the argument
// T depends on template parameters.
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 042415f..24f2e6f 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -87,6 +87,7 @@
// GTEST_OS_AIX - IBM AIX
// GTEST_OS_CYGWIN - Cygwin
// GTEST_OS_LINUX - Linux
+// GTEST_OS_LINUX_ANDROID - Google Android
// GTEST_OS_MAC - Mac OS X
// GTEST_OS_NACL - Google Native Client (NaCl)
// GTEST_OS_SOLARIS - Sun Solaris
@@ -225,6 +226,9 @@
# define GTEST_OS_MAC 1
#elif defined __linux__
# define GTEST_OS_LINUX 1
+# ifdef ANDROID
+# define GTEST_OS_LINUX_ANDROID 1
+# endif // ANDROID
#elif defined __MVS__
# define GTEST_OS_ZOS 1
#elif defined(__sun) && defined(__SVR4)
@@ -336,8 +340,10 @@
// is available.
// Cygwin 1.7 and below doesn't support ::std::wstring.
-// Solaris' libc++ doesn't support it either.
-# define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
+// Solaris' libc++ doesn't support it either. Android has
+// no support for it at least as recent as Froyo (2.2).
+# define GTEST_HAS_STD_WSTRING \
+ (!(GTEST_OS_LINUX_ANDROID || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS))
#endif // GTEST_HAS_STD_WSTRING
diff --git a/src/gtest.cc b/src/gtest.cc
index 3859d5a..a48aea9 100644
--- a/src/gtest.cc
+++ b/src/gtest.cc
@@ -1621,11 +1621,11 @@ bool String::CaseInsensitiveWideCStringEquals(const wchar_t* lhs,
#if GTEST_OS_WINDOWS
return _wcsicmp(lhs, rhs) == 0;
-#elif GTEST_OS_LINUX
+#elif GTEST_OS_LINUX && !GTEST_OS_LINUX_ANDROID
return wcscasecmp(lhs, rhs) == 0;
#else
- // Mac OS X and Cygwin don't define wcscasecmp. Other unknown OSes
- // may not define it either.
+ // Android, Mac OS X and Cygwin don't define wcscasecmp.
+ // Other unknown OSes may not define it either.
wint_t left, right;
do {
left = towlower(*lhs++);