Cleans up macro definitions.
This commit is contained in:
@@ -63,21 +63,15 @@
|
||||
|
||||
// This header defines the following utilities:
|
||||
//
|
||||
// Macros indicating the name of the Google C++ Testing Framework project:
|
||||
// GTEST_NAME - a string literal of the project name.
|
||||
// GTEST_FLAG_PREFIX - a string literal of the prefix all Google
|
||||
// Test flag names share.
|
||||
// GTEST_FLAG_PREFIX_UPPER - a string literal of the prefix all Google
|
||||
// Test flag names share, in upper case.
|
||||
//
|
||||
// Macros indicating the current platform:
|
||||
// GTEST_OS_CYGWIN - defined iff compiled on Cygwin.
|
||||
// GTEST_OS_LINUX - defined iff compiled on Linux.
|
||||
// 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_WINDOWS - defined iff compiled on Windows.
|
||||
// GTEST_OS_ZOS - defined iff compiled on IBM z/OS.
|
||||
// Macros indicating the current platform (defined to 1 if compiled on
|
||||
// the given platform; otherwise undefined):
|
||||
// GTEST_OS_CYGWIN - Cygwin
|
||||
// GTEST_OS_LINUX - Linux
|
||||
// GTEST_OS_MAC - Mac OS X
|
||||
// GTEST_OS_SOLARIS - Sun Solaris
|
||||
// GTEST_OS_SYMBIAN - Symbian
|
||||
// GTEST_OS_WINDOWS - Windows
|
||||
// GTEST_OS_ZOS - z/OS
|
||||
//
|
||||
// Among the platforms, Cygwin, Linux, Max OS X, and Windows have the
|
||||
// most stable support. Since core members of the Google Test project
|
||||
@@ -86,19 +80,18 @@
|
||||
// googletestframework@googlegroups.com (patches for fixing them are
|
||||
// even more welcome!).
|
||||
//
|
||||
// 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:
|
||||
// GTEST_HAS_COMBINE - defined iff Combine construct is supported
|
||||
// in value-parameterized tests.
|
||||
// GTEST_HAS_DEATH_TEST - defined iff death tests are supported.
|
||||
// GTEST_HAS_PARAM_TEST - defined iff value-parameterized tests are
|
||||
// supported.
|
||||
// GTEST_HAS_TYPED_TEST - defined iff typed tests are supported.
|
||||
// GTEST_HAS_TYPED_TEST_P - defined iff type-parameterized tests are
|
||||
// supported.
|
||||
// GTEST_USES_POSIX_RE - defined iff enhanced POSIX regex is used.
|
||||
// GTEST_USES_SIMPLE_RE - defined iff our own simple regex is used;
|
||||
// Macros indicating available Google Test features (defined to 1 if
|
||||
// the corresponding feature is supported; otherwise undefined):
|
||||
// GTEST_HAS_COMBINE - the Combine() function (for value-parameterized
|
||||
// tests)
|
||||
// GTEST_HAS_DEATH_TEST - death tests
|
||||
// GTEST_HAS_PARAM_TEST - value-parameterized tests
|
||||
// GTEST_HAS_TYPED_TEST - typed tests
|
||||
// GTEST_HAS_TYPED_TEST_P - type-parameterized tests
|
||||
// GTEST_USES_POSIX_RE - enhanced POSIX regex is used.
|
||||
// GTEST_USES_SIMPLE_RE - our own simple regex is used;
|
||||
// the above two are mutually exclusive.
|
||||
//
|
||||
// Macros for basic C++ coding:
|
||||
@@ -158,9 +151,9 @@
|
||||
#include <stdio.h>
|
||||
#include <iostream> // Used for GTEST_CHECK_
|
||||
|
||||
#define GTEST_NAME "Google Test"
|
||||
#define GTEST_FLAG_PREFIX "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER "GTEST_"
|
||||
#define GTEST_NAME_ "Google Test"
|
||||
#define GTEST_FLAG_PREFIX_ "gtest_"
|
||||
#define GTEST_FLAG_PREFIX_UPPER_ "GTEST_"
|
||||
|
||||
// Determines the version of gcc that is used to compile this.
|
||||
#ifdef __GNUC__
|
||||
@@ -171,26 +164,26 @@
|
||||
|
||||
// Determines the platform on which Google Test is compiled.
|
||||
#ifdef __CYGWIN__
|
||||
#define GTEST_OS_CYGWIN
|
||||
#define GTEST_OS_CYGWIN 1
|
||||
#elif __SYMBIAN32__
|
||||
#define GTEST_OS_SYMBIAN
|
||||
#define GTEST_OS_SYMBIAN 1
|
||||
#elif defined _MSC_VER
|
||||
// TODO(kenton@google.com): GTEST_OS_WINDOWS is currently used to mean
|
||||
// both "The OS is Windows" and "The compiler is MSVC". These
|
||||
// meanings really should be separated in order to better support
|
||||
// Windows compilers other than MSVC.
|
||||
#define GTEST_OS_WINDOWS
|
||||
#define GTEST_OS_WINDOWS 1
|
||||
#elif defined __APPLE__
|
||||
#define GTEST_OS_MAC
|
||||
#define GTEST_OS_MAC 1
|
||||
#elif defined __linux__
|
||||
#define GTEST_OS_LINUX
|
||||
#define GTEST_OS_LINUX 1
|
||||
#elif defined __MVS__
|
||||
#define GTEST_OS_ZOS
|
||||
#define GTEST_OS_ZOS 1
|
||||
#elif defined(__sun) && defined(__SVR4)
|
||||
#define GTEST_OS_SOLARIS
|
||||
#define GTEST_OS_SOLARIS 1
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if defined(GTEST_OS_LINUX)
|
||||
#if GTEST_OS_LINUX
|
||||
|
||||
// On some platforms, <regex.h> needs someone to define size_t, and
|
||||
// won't compile otherwise. We can #include it here as we already
|
||||
@@ -255,14 +248,14 @@
|
||||
// TODO(wan@google.com): uses autoconf to detect whether ::std::wstring
|
||||
// is available.
|
||||
|
||||
#if defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
#if GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
// Cygwin 1.5 and below doesn't support ::std::wstring.
|
||||
// Cygwin 1.7 might add wstring support; this should be updated when clear.
|
||||
// Solaris' libc++ doesn't support it either.
|
||||
#define GTEST_HAS_STD_WSTRING 0
|
||||
#else
|
||||
#define GTEST_HAS_STD_WSTRING GTEST_HAS_STD_STRING
|
||||
#endif // defined(GTEST_OS_CYGWIN) || defined(GTEST_OS_SOLARIS)
|
||||
#endif // GTEST_OS_CYGWIN || GTEST_OS_SOLARIS
|
||||
|
||||
#endif // GTEST_HAS_STD_WSTRING
|
||||
|
||||
@@ -324,13 +317,7 @@
|
||||
// Determines whether <pthread.h> is available.
|
||||
#ifndef GTEST_HAS_PTHREAD
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) || defined(GTEST_OS_MAC)
|
||||
#define GTEST_HAS_PTHREAD 1
|
||||
#else
|
||||
#define GTEST_HAS_PTHREAD 0
|
||||
#endif // GTEST_OS_LINUX || GTEST_OS_MAC
|
||||
|
||||
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
|
||||
#endif // GTEST_HAS_PTHREAD
|
||||
|
||||
// Determines whether tr1/tuple is available. If you have tr1/tuple
|
||||
@@ -371,17 +358,17 @@
|
||||
#ifndef GTEST_HAS_CLONE
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
#if defined(GTEST_OS_LINUX) && !defined(__ia64__)
|
||||
#if GTEST_OS_LINUX && !defined(__ia64__)
|
||||
#define GTEST_HAS_CLONE 1
|
||||
#else
|
||||
#define GTEST_HAS_CLONE 0
|
||||
#endif // defined(GTEST_OS_LINUX) && !defined(__ia64__)
|
||||
#endif // GTEST_OS_LINUX && !defined(__ia64__)
|
||||
|
||||
#endif // GTEST_HAS_CLONE
|
||||
|
||||
// Determines whether to support death tests.
|
||||
#if GTEST_HAS_STD_STRING && GTEST_HAS_CLONE
|
||||
#define GTEST_HAS_DEATH_TEST
|
||||
#define GTEST_HAS_DEATH_TEST 1
|
||||
#include <vector>
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
@@ -392,7 +379,7 @@
|
||||
#if defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
// TODO(vladl@google.com): get the implementation rid of vector and list
|
||||
// to compile on MSVC 7.1.
|
||||
#define GTEST_HAS_PARAM_TEST
|
||||
#define GTEST_HAS_PARAM_TEST 1
|
||||
#endif // defined(__GNUC__) || (_MSC_VER >= 1400)
|
||||
|
||||
// Determines whether to support type-driven tests.
|
||||
@@ -406,15 +393,13 @@
|
||||
|
||||
// Determines whether to support Combine(). This only makes sense when
|
||||
// value-parameterized tests are enabled.
|
||||
#if defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE
|
||||
#endif // defined(GTEST_HAS_PARAM_TEST) && GTEST_HAS_TR1_TUPLE
|
||||
#if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
#define GTEST_HAS_COMBINE 1
|
||||
#endif // GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE
|
||||
|
||||
// Determines whether the system compiler uses UTF-16 for encoding wide strings.
|
||||
#if defined(GTEST_OS_WINDOWS) || defined(GTEST_OS_CYGWIN) || \
|
||||
defined(GTEST_OS_SYMBIAN)
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ 1
|
||||
#endif
|
||||
#define GTEST_WIDE_STRING_USES_UTF16_ \
|
||||
(GTEST_OS_WINDOWS || GTEST_OS_CYGWIN || GTEST_OS_SYMBIAN)
|
||||
|
||||
// Defines some utility macros.
|
||||
|
||||
@@ -610,7 +595,7 @@ inline void FlushInfoLog() { fflush(NULL); }
|
||||
// CaptureStderr - starts capturing stderr.
|
||||
// GetCapturedStderr - stops capturing stderr and returns the captured string.
|
||||
|
||||
#ifdef GTEST_HAS_DEATH_TEST
|
||||
#if GTEST_HAS_DEATH_TEST
|
||||
|
||||
// A copy of all command line arguments. Set by InitGoogleTest().
|
||||
extern ::std::vector<String> g_argvs;
|
||||
@@ -704,7 +689,7 @@ struct is_pointer<T*> : public true_type {};
|
||||
// Defines BiggestInt as the biggest signed integer type the compiler
|
||||
// supports.
|
||||
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 BiggestInt;
|
||||
#else
|
||||
typedef long long BiggestInt; // NOLINT
|
||||
@@ -762,7 +747,7 @@ class TypeWithSize<4> {
|
||||
template <>
|
||||
class TypeWithSize<8> {
|
||||
public:
|
||||
#ifdef GTEST_OS_WINDOWS
|
||||
#if GTEST_OS_WINDOWS
|
||||
typedef __int64 Int;
|
||||
typedef unsigned __int64 UInt;
|
||||
#else
|
||||
@@ -785,7 +770,7 @@ inline const char* GetEnv(const char* name) {
|
||||
#ifdef _WIN32_WCE // We are on Windows CE.
|
||||
// CE has no environment variables.
|
||||
return NULL;
|
||||
#elif defined(GTEST_OS_WINDOWS) // We are on Windows proper.
|
||||
#elif GTEST_OS_WINDOWS // We are on Windows proper.
|
||||
// MSVC 8 deprecates getenv(), so we want to suppress warning 4996
|
||||
// (deprecated function) there.
|
||||
#pragma warning(push) // Saves the current warning state.
|
||||
|
||||
Reference in New Issue
Block a user