aboutsummaryrefslogtreecommitdiffstats
path: root/include/gtest
diff options
context:
space:
mode:
authorzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-06-19 17:23:54 +0000
committerzhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925>2009-06-19 17:23:54 +0000
commit4853a503371f39aa22e14adcdecea71c09841e34 (patch)
treeb16ed6470fbbc4ea8eace7f836ae8e6448a369a3 /include/gtest
parentae3247986bbbafcc913b5fe6132090ad6f1c3f36 (diff)
downloadgoogletest-4853a503371f39aa22e14adcdecea71c09841e34.tar.gz
googletest-4853a503371f39aa22e14adcdecea71c09841e34.tar.bz2
googletest-4853a503371f39aa22e14adcdecea71c09841e34.zip
Fixes compatibility with Windows CE and Symbian (By Tim Baverstock and Mika).
Diffstat (limited to 'include/gtest')
-rw-r--r--include/gtest/gtest-param-test.h5
-rw-r--r--include/gtest/internal/gtest-internal.h2
-rw-r--r--include/gtest/internal/gtest-port.h35
-rw-r--r--include/gtest/internal/gtest-tuple.h6
-rw-r--r--include/gtest/internal/gtest-tuple.h.pump6
5 files changed, 41 insertions, 13 deletions
diff --git a/include/gtest/gtest-param-test.h b/include/gtest/gtest-param-test.h
index 421517d5..6c8622a6 100644
--- a/include/gtest/gtest-param-test.h
+++ b/include/gtest/gtest-param-test.h
@@ -146,10 +146,11 @@ INSTANTIATE_TEST_CASE_P(AnotherInstantiationName, FooTest, ValuesIn(pets));
#endif // 0
+#include <gtest/internal/gtest-port.h>
+#if !GTEST_OS_SYMBIAN
#include <utility>
-
-#include <gtest/internal/gtest-port.h>
+#endif
#if GTEST_HAS_PARAM_TEST
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h
index d596b3a6..6e605e04 100644
--- a/include/gtest/internal/gtest-internal.h
+++ b/include/gtest/internal/gtest-internal.h
@@ -621,7 +621,7 @@ class TypedTestCasePState {
"REGISTER_TYPED_TEST_CASE_P(%s, ...).\n",
FormatFileLocation(file, line).c_str(), test_name, case_name);
fflush(stderr);
- abort();
+ posix::Abort();
}
defined_test_names_.insert(test_name);
return true;
diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h
index 886e2dd8..e67a498d 100644
--- a/include/gtest/internal/gtest-port.h
+++ b/include/gtest/internal/gtest-port.h
@@ -154,10 +154,13 @@
// Int32FromGTestEnv() - parses an Int32 environment variable.
// StringFromGTestEnv() - parses a string environment variable.
+#include <stddef.h> // For ptrdiff_t
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#ifndef _WIN32_WCE
#include <sys/stat.h>
+#endif // !_WIN32_WCE
#include <iostream> // NOLINT
@@ -191,7 +194,7 @@
#define GTEST_OS_SOLARIS 1
#endif // __CYGWIN__
-#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC
+#if GTEST_OS_CYGWIN || GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_SYMBIAN
// On some platforms, <regex.h> needs someone to define size_t, and
// won't compile otherwise. We can #include it here as we already
@@ -206,8 +209,10 @@
#elif GTEST_OS_WINDOWS
+#ifndef _WIN32_WCE
#include <direct.h> // NOLINT
#include <io.h> // NOLINT
+#endif // !_WIN32_WCE
// <regex.h> is not available on Windows. Use our own simple regex
// implementation instead.
@@ -445,7 +450,8 @@
#if GTEST_HAS_STD_STRING && (GTEST_OS_LINUX || \
GTEST_OS_MAC || \
GTEST_OS_CYGWIN || \
- (GTEST_OS_WINDOWS && _MSC_VER >= 1400))
+ (GTEST_OS_WINDOWS && (_MSC_VER >= 1400) && \
+ !defined(_WIN32_WCE)))
#define GTEST_HAS_DEATH_TEST 1
#include <vector> // NOLINT
#endif
@@ -813,20 +819,30 @@ inline int StrCaseCmp(const char* s1, const char* s2) {
return stricmp(s1, s2);
}
inline char* StrDup(const char* src) { return strdup(src); }
-#else
+#else // !__BORLANDC__
+#ifdef _WIN32_WCE
+inline int IsATTY(int /* fd */) { return 0; }
+#else // !_WIN32_WCE
inline int IsATTY(int fd) { return _isatty(fd); }
+#endif // _WIN32_WCE
inline int StrCaseCmp(const char* s1, const char* s2) {
return _stricmp(s1, s2);
}
inline char* StrDup(const char* src) { return _strdup(src); }
#endif // __BORLANDC__
+#ifdef _WIN32_WCE
+inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
+// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
+// time and thus not defined there.
+#else // !_WIN32_WCE
inline int FileNo(FILE* file) { return _fileno(file); }
inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
inline int RmDir(const char* dir) { return _rmdir(dir); }
inline bool IsDir(const StatStruct& st) {
return (_S_IFDIR & st.st_mode) != 0;
}
+#endif // _WIN32_WCE
#else
@@ -855,15 +871,25 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); }
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
return strncpy(dest, src, n);
}
+
+// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
+// StrError() aren't needed on Windows CE at this time and thus not
+// defined there.
+
+#ifndef _WIN32_WCE
inline int ChDir(const char* dir) { return chdir(dir); }
+#endif
inline FILE* FOpen(const char* path, const char* mode) {
return fopen(path, mode);
}
+#ifndef _WIN32_WCE
inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
return freopen(path, mode, stream);
}
inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
+#endif
inline int FClose(FILE* fp) { return fclose(fp); }
+#ifndef _WIN32_WCE
inline int Read(int fd, void* buf, unsigned int count) {
return static_cast<int>(read(fd, buf, count));
}
@@ -872,6 +898,7 @@ inline int Write(int fd, const void* buf, unsigned int count) {
}
inline int Close(int fd) { return close(fd); }
inline const char* StrError(int errnum) { return strerror(errnum); }
+#endif
inline const char* GetEnv(const char* name) {
#ifdef _WIN32_WCE // We are on Windows CE, which has no environment variables.
return NULL;
@@ -992,7 +1019,7 @@ class GTestCheckProvider {
}
~GTestCheckProvider() {
::std::cerr << ::std::endl;
- abort();
+ posix::Abort();
}
void FormatFileLocation(const char* file, int line) {
if (file == NULL)
diff --git a/include/gtest/internal/gtest-tuple.h b/include/gtest/internal/gtest-tuple.h
index 1c2034a0..be23e8eb 100644
--- a/include/gtest/internal/gtest-tuple.h
+++ b/include/gtest/internal/gtest-tuple.h
@@ -33,8 +33,8 @@
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-#ifndef GTEST_INCLUDE_GTEST_INTERAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERAL_GTEST_TUPLE_H_
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
#include <utility> // For ::std::pair.
@@ -942,4 +942,4 @@ inline bool operator!=(const GTEST_10_TUPLE_(T)& t,
#undef GTEST_ADD_REF_
#undef GTEST_TUPLE_ELEMENT_
-#endif // GTEST_INCLUDE_GTEST_INTERAL_GTEST_TUPLE_H_
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
diff --git a/include/gtest/internal/gtest-tuple.h.pump b/include/gtest/internal/gtest-tuple.h.pump
index 1ea70859..33fd6b6d 100644
--- a/include/gtest/internal/gtest-tuple.h.pump
+++ b/include/gtest/internal/gtest-tuple.h.pump
@@ -34,8 +34,8 @@ $$ This meta comment fixes auto-indentation in Emacs. }}
// Implements a subset of TR1 tuple needed by Google Test and Google Mock.
-#ifndef GTEST_INCLUDE_GTEST_INTERAL_GTEST_TUPLE_H_
-#define GTEST_INCLUDE_GTEST_INTERAL_GTEST_TUPLE_H_
+#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
+#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_
#include <utility> // For ::std::pair.
@@ -317,4 +317,4 @@ $for j [[
#undef GTEST_ADD_REF_
#undef GTEST_TUPLE_ELEMENT_
-#endif // GTEST_INCLUDE_GTEST_INTERAL_GTEST_TUPLE_H_
+#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TUPLE_H_