Merge branch 'master' into win-libcxx2
This commit is contained in:
@@ -73,11 +73,9 @@
|
||||
// GTEST_HAS_EXCEPTIONS - Define it to 1/0 to indicate that exceptions
|
||||
// are enabled.
|
||||
// GTEST_HAS_GLOBAL_STRING - Define it to 1/0 to indicate that ::string
|
||||
// is/isn't available (some systems define
|
||||
// ::string, which is different to std::string).
|
||||
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::string
|
||||
// is/isn't available (some systems define
|
||||
// ::wstring, which is different to std::wstring).
|
||||
// is/isn't available
|
||||
// GTEST_HAS_GLOBAL_WSTRING - Define it to 1/0 to indicate that ::wstring
|
||||
// is/isn't available
|
||||
// GTEST_HAS_POSIX_RE - Define it to 1/0 to indicate that POSIX regular
|
||||
// expressions are/aren't available.
|
||||
// GTEST_HAS_PTHREAD - Define it to 1/0 to indicate that <pthread.h>
|
||||
@@ -178,7 +176,7 @@
|
||||
// GTEST_HAS_POSIX_RE (see above) which users can
|
||||
// define themselves.
|
||||
// GTEST_USES_SIMPLE_RE - our own simple regex is used;
|
||||
// the above two are mutually exclusive.
|
||||
// the above RE\b(s) are mutually exclusive.
|
||||
// GTEST_CAN_COMPARE_NULL - accepts untyped NULL in EXPECT_EQ().
|
||||
|
||||
// Misc public macros
|
||||
@@ -207,6 +205,7 @@
|
||||
//
|
||||
// C++11 feature wrappers:
|
||||
//
|
||||
// testing::internal::forward - portability wrapper for std::forward.
|
||||
// testing::internal::move - portability wrapper for std::move.
|
||||
//
|
||||
// Synchronization:
|
||||
@@ -272,10 +271,12 @@
|
||||
# include <TargetConditionals.h>
|
||||
#endif
|
||||
|
||||
// Brings in the definition of HAS_GLOBAL_STRING. This must be done
|
||||
// BEFORE we test HAS_GLOBAL_STRING.
|
||||
#include <string> // NOLINT
|
||||
#include <algorithm> // NOLINT
|
||||
#include <iostream> // NOLINT
|
||||
#include <sstream> // NOLINT
|
||||
#include <string> // NOLINT
|
||||
#include <utility>
|
||||
#include <vector> // NOLINT
|
||||
|
||||
@@ -614,8 +615,8 @@ typedef struct _RTL_CRITICAL_SECTION GTEST_CRITICAL_SECTION;
|
||||
//
|
||||
// To disable threading support in Google Test, add -DGTEST_HAS_PTHREAD=0
|
||||
// to your compiler flags.
|
||||
#define GTEST_HAS_PTHREAD \
|
||||
(GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
|
||||
#define GTEST_HAS_PTHREAD \
|
||||
(GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_HPUX || GTEST_OS_QNX || \
|
||||
GTEST_OS_FREEBSD || GTEST_OS_NACL || GTEST_OS_NETBSD || GTEST_OS_FUCHSIA)
|
||||
#endif // GTEST_HAS_PTHREAD
|
||||
|
||||
@@ -809,9 +810,9 @@ using ::std::tuple_size;
|
||||
// Google Test does not support death tests for VC 7.1 and earlier as
|
||||
// abort() in a VC 7.1 application compiled as GUI in debug config
|
||||
// pops up a dialog window that cannot be suppressed programmatically.
|
||||
#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
|
||||
(GTEST_OS_MAC && !GTEST_OS_IOS) || \
|
||||
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
|
||||
#if (GTEST_OS_LINUX || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \
|
||||
(GTEST_OS_MAC && !GTEST_OS_IOS) || \
|
||||
(GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \
|
||||
GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX || GTEST_OS_HPUX || \
|
||||
GTEST_OS_OPENBSD || GTEST_OS_QNX || GTEST_OS_FREEBSD || GTEST_OS_NETBSD)
|
||||
# define GTEST_HAS_DEATH_TEST 1
|
||||
@@ -827,9 +828,10 @@ using ::std::tuple_size;
|
||||
# define GTEST_HAS_TYPED_TEST_P 1
|
||||
#endif
|
||||
|
||||
// Determines whether to support Combine().
|
||||
// The implementation doesn't work on Sun Studio since it doesn't
|
||||
// understand templated conversion operators.
|
||||
// Determines whether to support Combine(). This only makes sense when
|
||||
// value-parameterized tests are enabled. The implementation doesn't
|
||||
// work on Sun Studio since it doesn't understand templated conversion
|
||||
// operators.
|
||||
#if (GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_) && !defined(__SUNPRO_CC)
|
||||
# define GTEST_HAS_COMBINE 1
|
||||
#endif
|
||||
@@ -1129,6 +1131,16 @@ struct StaticAssertTypeEqHelper<T, T> {
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
// Same as std::is_same<>.
|
||||
template <typename T, typename U>
|
||||
struct IsSame {
|
||||
enum { value = false };
|
||||
};
|
||||
template <typename T>
|
||||
struct IsSame<T, T> {
|
||||
enum { value = true };
|
||||
};
|
||||
|
||||
// Evaluates to the number of elements in 'array'.
|
||||
#define GTEST_ARRAY_SIZE_(array) (sizeof(array) / sizeof(array[0]))
|
||||
|
||||
@@ -1192,6 +1204,10 @@ class scoped_ptr {
|
||||
|
||||
// Defines RE.
|
||||
|
||||
#if GTEST_USES_PCRE
|
||||
using ::RE;
|
||||
#elif GTEST_USES_POSIX_RE || GTEST_USES_SIMPLE_RE
|
||||
|
||||
// A simple C++ wrapper for <regex.h>. It uses the POSIX Extended
|
||||
// Regular Expression syntax.
|
||||
class GTEST_API_ RE {
|
||||
@@ -1203,11 +1219,11 @@ class GTEST_API_ RE {
|
||||
// Constructs an RE from a string.
|
||||
RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT
|
||||
|
||||
#if GTEST_HAS_GLOBAL_STRING
|
||||
# if GTEST_HAS_GLOBAL_STRING
|
||||
|
||||
RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT
|
||||
|
||||
#endif // GTEST_HAS_GLOBAL_STRING
|
||||
# endif // GTEST_HAS_GLOBAL_STRING
|
||||
|
||||
RE(const char* regex) { Init(regex); } // NOLINT
|
||||
~RE();
|
||||
@@ -1229,7 +1245,7 @@ class GTEST_API_ RE {
|
||||
return PartialMatch(str.c_str(), re);
|
||||
}
|
||||
|
||||
#if GTEST_HAS_GLOBAL_STRING
|
||||
# if GTEST_HAS_GLOBAL_STRING
|
||||
|
||||
static bool FullMatch(const ::string& str, const RE& re) {
|
||||
return FullMatch(str.c_str(), re);
|
||||
@@ -1238,7 +1254,7 @@ class GTEST_API_ RE {
|
||||
return PartialMatch(str.c_str(), re);
|
||||
}
|
||||
|
||||
#endif // GTEST_HAS_GLOBAL_STRING
|
||||
# endif // GTEST_HAS_GLOBAL_STRING
|
||||
|
||||
static bool FullMatch(const char* str, const RE& re);
|
||||
static bool PartialMatch(const char* str, const RE& re);
|
||||
@@ -1252,20 +1268,22 @@ class GTEST_API_ RE {
|
||||
const char* pattern_;
|
||||
bool is_valid_;
|
||||
|
||||
#if GTEST_USES_POSIX_RE
|
||||
# if GTEST_USES_POSIX_RE
|
||||
|
||||
regex_t full_regex_; // For FullMatch().
|
||||
regex_t partial_regex_; // For PartialMatch().
|
||||
|
||||
#else // GTEST_USES_SIMPLE_RE
|
||||
# else // GTEST_USES_SIMPLE_RE
|
||||
|
||||
const char* full_pattern_; // For FullMatch();
|
||||
|
||||
#endif
|
||||
# endif
|
||||
|
||||
GTEST_DISALLOW_ASSIGN_(RE);
|
||||
};
|
||||
|
||||
#endif // GTEST_USES_PCRE
|
||||
|
||||
// Formats a source file path and a line number as they would appear
|
||||
// in an error message from the compiler used to compile this code.
|
||||
GTEST_API_ ::std::string FormatFileLocation(const char* file, int line);
|
||||
@@ -1351,13 +1369,57 @@ inline void FlushInfoLog() { fflush(NULL); }
|
||||
GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
|
||||
<< gtest_error
|
||||
|
||||
// Adds reference to a type if it is not a reference type,
|
||||
// otherwise leaves it unchanged. This is the same as
|
||||
// tr1::add_reference, which is not widely available yet.
|
||||
template <typename T>
|
||||
struct AddReference { typedef T& type; }; // NOLINT
|
||||
template <typename T>
|
||||
struct AddReference<T&> { typedef T& type; }; // NOLINT
|
||||
|
||||
// A handy wrapper around AddReference that works when the argument T
|
||||
// depends on template parameters.
|
||||
#define GTEST_ADD_REFERENCE_(T) \
|
||||
typename ::testing::internal::AddReference<T>::type
|
||||
|
||||
// Transforms "T" into "const T&" according to standard reference collapsing
|
||||
// rules (this is only needed as a backport for C++98 compilers that do not
|
||||
// support reference collapsing). Specifically, it transforms:
|
||||
//
|
||||
// char ==> const char&
|
||||
// const char ==> const char&
|
||||
// char& ==> char&
|
||||
// const char& ==> const char&
|
||||
//
|
||||
// Note that the non-const reference will not have "const" added. This is
|
||||
// standard, and necessary so that "T" can always bind to "const T&".
|
||||
template <typename T>
|
||||
struct ConstRef { typedef const T& type; };
|
||||
template <typename T>
|
||||
struct ConstRef<T&> { typedef T& type; };
|
||||
|
||||
// The argument T must depend on some template parameters.
|
||||
#define GTEST_REFERENCE_TO_CONST_(T) \
|
||||
typename ::testing::internal::ConstRef<T>::type
|
||||
|
||||
#if GTEST_HAS_STD_MOVE_
|
||||
using std::forward;
|
||||
using std::move;
|
||||
|
||||
template <typename T>
|
||||
struct RvalueRef {
|
||||
typedef T&& type;
|
||||
};
|
||||
#else // GTEST_HAS_STD_MOVE_
|
||||
template <typename T>
|
||||
const T& move(const T& t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct RvalueRef {
|
||||
typedef const T& type;
|
||||
};
|
||||
#endif // GTEST_HAS_STD_MOVE_
|
||||
|
||||
// INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
|
||||
@@ -1458,7 +1520,6 @@ GTEST_API_ void CaptureStderr();
|
||||
GTEST_API_ std::string GetCapturedStderr();
|
||||
|
||||
#endif // GTEST_HAS_STREAM_REDIRECTION
|
||||
|
||||
// Returns the size (in bytes) of a file.
|
||||
GTEST_API_ size_t GetFileSize(FILE* file);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user