Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
d2849f57
Commit
d2849f57
authored
Nov 10, 2008
by
shiqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Makes Google Test compile on Solaris and z/OS. By Rainer Klaffenboeck.
parent
cea25099
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
27 deletions
+63
-27
CONTRIBUTORS
CONTRIBUTORS
+1
-0
gtest-internal.h
include/gtest/internal/gtest-internal.h
+19
-13
gtest-port.h
include/gtest/internal/gtest-port.h
+26
-11
gtest-filepath.cc
src/gtest-filepath.cc
+12
-2
gtest.cc
src/gtest.cc
+5
-1
No files found.
CONTRIBUTORS
View file @
d2849f57
...
@@ -20,6 +20,7 @@ Patrick Hanna <phanna@google.com>
...
@@ -20,6 +20,7 @@ Patrick Hanna <phanna@google.com>
Patrick Riley <pfr@google.com>
Patrick Riley <pfr@google.com>
Peter Kaminski <piotrk@google.com>
Peter Kaminski <piotrk@google.com>
Preston Jackson <preston.jackson@gmail.com>
Preston Jackson <preston.jackson@gmail.com>
Rainer Klaffenboeck <rainer.klaffenboeck@dynatrace.com>
Russ Cox <rsc@google.com>
Russ Cox <rsc@google.com>
Russ Rufer <russ@pentad.com>
Russ Rufer <russ@pentad.com>
Sean Mcafee <eefacm@gmail.com>
Sean Mcafee <eefacm@gmail.com>
...
...
include/gtest/internal/gtest-internal.h
View file @
d2849f57
...
@@ -150,16 +150,17 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT
...
@@ -150,16 +150,17 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT
// A compile-time bool constant that is true if and only if x is a
// 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
// null pointer literal (i.e. NULL or any 0-valued compile-time
// integral constant).
// integral constant).
#ifdef __SYMBIAN32__ // Symbian
#ifdef GTEST_ELLIPSIS_NEEDS_COPY_
// Passing non-POD classes through ellipsis (...) crashes the ARM compiler.
// Passing non-POD classes through ellipsis (...) crashes the ARM
// The Nokia Symbian compiler tries to instantiate a copy constructor for
// compiler. The Nokia Symbian and the IBM XL C/C++ compiler try to
// objects passed through ellipsis (...), failing for uncopyable objects.
// instantiate a copy constructor for objects passed through ellipsis
// Hence we define this to false (and lose support for NULL detection).
// (...), failing for uncopyable objects. Hence we define this to
// false (and lose support for NULL detection).
#define GTEST_IS_NULL_LITERAL_(x) false
#define GTEST_IS_NULL_LITERAL_(x) false
#else
// ! GTEST_OS_SYMBIAN
#else
#define GTEST_IS_NULL_LITERAL_(x) \
#define GTEST_IS_NULL_LITERAL_(x) \
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
(sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1)
#endif // GTEST_
OS_SYMBIAN
#endif // GTEST_
ELLIPSIS_NEEDS_COPY_
// Appends the user-supplied message to the Google-Test-generated message.
// Appends the user-supplied message to the Google-Test-generated message.
String
AppendUserMessage
(
const
String
&
gtest_msg
,
String
AppendUserMessage
(
const
String
&
gtest_msg
,
...
@@ -196,12 +197,13 @@ String StreamableToString(const T& streamable);
...
@@ -196,12 +197,13 @@ String StreamableToString(const T& streamable);
// Formats a value to be used in a failure message.
// Formats a value to be used in a failure message.
#ifdef GTEST_
OS_SYMBIAN
#ifdef GTEST_
NEEDS_IS_POINTER_
// These are needed as the Nokia Symbian Compiler cannot decide between
// These are needed as the Nokia Symbian and IBM XL C/C++ compilers
// const T& and const T* in a function template. The Nokia compiler _can_
// cannot decide between const T& and const T* in a function template.
// decide between class template specializations for T and T*, so a
// These compilers _can_ decide between class template specializations
// tr1::type_traits-like is_pointer works, and we can overload on that.
// 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
// This overload makes sure that all pointers (including
// those to char or wchar_t) are printed as raw pointers.
// those to char or wchar_t) are printed as raw pointers.
...
@@ -225,6 +227,10 @@ inline String FormatForFailureMessage(const T& value) {
...
@@ -225,6 +227,10 @@ inline String FormatForFailureMessage(const T& value) {
#else
#else
// These are needed as the above solution using is_pointer has the
// limitation that T cannot be a type without external linkage, when
// compiled using MSVC.
template
<
typename
T
>
template
<
typename
T
>
inline
String
FormatForFailureMessage
(
const
T
&
value
)
{
inline
String
FormatForFailureMessage
(
const
T
&
value
)
{
return
StreamableToString
(
value
);
return
StreamableToString
(
value
);
...
@@ -237,7 +243,7 @@ inline String FormatForFailureMessage(T* pointer) {
...
@@ -237,7 +243,7 @@ inline String FormatForFailureMessage(T* pointer) {
return
StreamableToString
(
static_cast
<
const
void
*>
(
pointer
));
return
StreamableToString
(
static_cast
<
const
void
*>
(
pointer
));
}
}
#endif // GTEST_
OS_SYMBIAN
#endif // GTEST_
NEEDS_IS_POINTER_
// These overloaded versions handle narrow and wide characters.
// These overloaded versions handle narrow and wide characters.
String
FormatForFailureMessage
(
char
ch
);
String
FormatForFailureMessage
(
char
ch
);
...
...
include/gtest/internal/gtest-port.h
View file @
d2849f57
...
@@ -70,8 +70,11 @@
...
@@ -70,8 +70,11 @@
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
// GTEST_OS_LINUX - defined iff compiled on Linux.
// GTEST_OS_LINUX - defined iff compiled on Linux.
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
// GTEST_OS_MAC - defined iff compiled on Mac OS X.
// GTEST_OS_SOLARIS - defined iff compiled on Sun Solaris.
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
// GTEST_OS_SYMBIAN - defined iff compiled for Symbian.
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
// GTEST_OS_WINDOWS - defined iff compiled on Windows.
// GTEST_OS_ZOS - defined iff compiled on IBM z/OS.
//
// Note that it is possible that none of the GTEST_OS_ macros are defined.
// Note that it is possible that none of the GTEST_OS_ macros are defined.
//
//
// Macros indicating available Google Test features:
// Macros indicating available Google Test features:
...
@@ -95,7 +98,7 @@
...
@@ -95,7 +98,7 @@
// and Google Test is thread-safe; or 0 otherwise.
// and Google Test is thread-safe; or 0 otherwise.
//
//
// Template meta programming:
// Template meta programming:
// is_pointer - as in TR1; needed on Symbian only.
// is_pointer - as in TR1; needed on Symbian
and IBM XL C/C++
only.
//
//
// Smart pointers:
// Smart pointers:
// scoped_ptr - as in TR2.
// scoped_ptr - as in TR2.
...
@@ -162,6 +165,10 @@
...
@@ -162,6 +165,10 @@
#define GTEST_OS_MAC
#define GTEST_OS_MAC
#elif defined __linux__
#elif defined __linux__
#define GTEST_OS_LINUX
#define GTEST_OS_LINUX
#elif defined __MVS__
#define GTEST_OS_ZOS
#elif defined(__sun) && defined(__SVR4)
#define GTEST_OS_SOLARIS
#endif // _MSC_VER
#endif // _MSC_VER
// Determines whether ::std::string and ::string are available.
// Determines whether ::std::string and ::string are available.
...
@@ -202,12 +209,13 @@
...
@@ -202,12 +209,13 @@
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
// is available.
// is available.
#ifdef GTEST_OS_CYGWIN
#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
// At least some versions of cygwin doesn't support ::std::wstring.
// At least some versions of cygwin don't support ::std::wstring.
// Solaris' libc++ doesn't support it either.
#define GTEST_HAS_STD_WSTRING 0
#define GTEST_HAS_STD_WSTRING 0
#else
#else
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
#endif //
GTEST_OS_CYGWIN
#endif //
defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
#endif // GTEST_HAS_STD_WSTRING
#endif // GTEST_HAS_STD_WSTRING
...
@@ -544,13 +552,22 @@ inline size_t GetThreadCount() { return 0; }
...
@@ -544,13 +552,22 @@ inline size_t GetThreadCount() { return 0; }
// Therefore Google Test is not thread-safe.
// Therefore Google Test is not thread-safe.
#define GTEST_IS_THREADSAFE 0
#define GTEST_IS_THREADSAFE 0
// Defines tr1::is_pointer (only needed for Symbian).
#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
#ifdef __SYMBIAN32__
// 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.
#define GTEST_NEEDS_IS_POINTER_ 1
// Symbian does not have tr1::type_traits, so we define our own is_pointer
#endif // defined(__SYMBIAN32__) || defined(__IBMCPP__)
// These are needed as the Nokia Symbian Compiler cannot decide between
// const T& and const T* in a function template.
template
<
bool
bool_value
>
template
<
bool
bool_value
>
struct
bool_constant
{
struct
bool_constant
{
...
@@ -568,8 +585,6 @@ struct is_pointer : public false_type {};
...
@@ -568,8 +585,6 @@ struct is_pointer : public false_type {};
template
<
typename
T
>
template
<
typename
T
>
struct
is_pointer
<
T
*>
:
public
true_type
{};
struct
is_pointer
<
T
*>
:
public
true_type
{};
#endif // __SYMBIAN32__
// Defines BiggestInt as the biggest signed integer type the compiler
// Defines BiggestInt as the biggest signed integer type the compiler
// supports.
// supports.
...
...
src/gtest-filepath.cc
View file @
d2849f57
...
@@ -50,6 +50,16 @@
...
@@ -50,6 +50,16 @@
#include <unistd.h>
#include <unistd.h>
#endif // _WIN32_WCE or _WIN32
#endif // _WIN32_WCE or _WIN32
#ifdef GTEST_OS_WINDOWS
#define GTEST_PATH_MAX_ _MAX_PATH
#elif defined(PATH_MAX)
#define GTEST_PATH_MAX_ PATH_MAX
#elif defined(_XOPEN_PATH_MAX)
#define GTEST_PATH_MAX_ _XOPEN_PATH_MAX
#else
#define GTEST_PATH_MAX_ _POSIX_PATH_MAX
#endif // GTEST_OS_WINDOWS
#include <gtest/internal/gtest-string.h>
#include <gtest/internal/gtest-string.h>
namespace
testing
{
namespace
testing
{
...
@@ -81,10 +91,10 @@ FilePath FilePath::GetCurrentDir() {
...
@@ -81,10 +91,10 @@ FilePath FilePath::GetCurrentDir() {
// something reasonable.
// something reasonable.
return
FilePath
(
kCurrentDirectoryString
);
return
FilePath
(
kCurrentDirectoryString
);
#elif defined(GTEST_OS_WINDOWS)
#elif defined(GTEST_OS_WINDOWS)
char
cwd
[
_MAX_PATH
+
1
]
=
{};
char
cwd
[
GTEST_PATH_MAX_
+
1
]
=
{};
return
FilePath
(
_getcwd
(
cwd
,
sizeof
(
cwd
))
==
NULL
?
""
:
cwd
);
return
FilePath
(
_getcwd
(
cwd
,
sizeof
(
cwd
))
==
NULL
?
""
:
cwd
);
#else
#else
char
cwd
[
PATH_MAX
+
1
]
=
{};
char
cwd
[
GTEST_PATH_MAX_
+
1
]
=
{};
return
FilePath
(
getcwd
(
cwd
,
sizeof
(
cwd
))
==
NULL
?
""
:
cwd
);
return
FilePath
(
getcwd
(
cwd
,
sizeof
(
cwd
))
==
NULL
?
""
:
cwd
);
#endif
#endif
}
}
...
...
src/gtest.cc
View file @
d2849f57
...
@@ -65,6 +65,10 @@
...
@@ -65,6 +65,10 @@
#define GTEST_HAS_GETTIMEOFDAY
#define GTEST_HAS_GETTIMEOFDAY
#include <sys/time.h> // NOLINT
#include <sys/time.h> // NOLINT
#elif defined(GTEST_OS_ZOS)
// On z/OS we additionally need strings.h for strcasecmp.
#include <strings.h>
#elif defined(_WIN32_WCE) // We are on Windows CE.
#elif defined(_WIN32_WCE) // We are on Windows CE.
#include <windows.h> // NOLINT
#include <windows.h> // NOLINT
...
@@ -2445,7 +2449,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
...
@@ -2445,7 +2449,7 @@ void ColoredPrintf(GTestColor color, const char* fmt, ...) {
va_list
args
;
va_list
args
;
va_start
(
args
,
fmt
);
va_start
(
args
,
fmt
);
#if defined(_WIN32_WCE) || defined(GTEST_OS_SYMBIAN)
#if defined(_WIN32_WCE) || defined(GTEST_OS_SYMBIAN)
|| defined(GTEST_OS_ZOS)
static
const
bool
use_color
=
false
;
static
const
bool
use_color
=
false
;
#else
#else
static
const
bool
use_color
=
ShouldUseColor
(
isatty
(
fileno
(
stdout
))
!=
0
);
static
const
bool
use_color
=
ShouldUseColor
(
isatty
(
fileno
(
stdout
))
!=
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment