Fixed Native Client build of gtest when using glibc (by Ben Smith).
This commit is contained in:
parent
1f7bb45e07
commit
2147489625
@ -72,6 +72,8 @@
|
||||
// Test's own tr1 tuple implementation should be
|
||||
// used. Unused when the user sets
|
||||
// GTEST_HAS_TR1_TUPLE to 0.
|
||||
// GTEST_LANG_CXX11 - Define it to 1/0 to indicate that Google Test
|
||||
// is building in C++11/C++98 mode.
|
||||
// GTEST_LINKED_AS_SHARED_LIBRARY
|
||||
// - Define to 1 when compiling tests that use
|
||||
// Google Test as a shared library (known as
|
||||
@ -259,6 +261,19 @@
|
||||
# define GTEST_OS_QNX 1
|
||||
#endif // __CYGWIN__
|
||||
|
||||
#ifndef GTEST_LANG_CXX11
|
||||
// gcc and clang define __GXX_EXPERIMENTAL_CXX0X__ when
|
||||
// -std={c,gnu}++{0x,11} is passed. The C++11 standard specifies a
|
||||
// value for __cplusplus, and recent versions of clang, gcc, and
|
||||
// probably other compilers set that too in C++11 mode.
|
||||
# if __GXX_EXPERIMENTAL_CXX0X__ || __cplusplus >= 201103L
|
||||
// Compiling in at least C++11 mode.
|
||||
# define GTEST_LANG_CXX11 1
|
||||
# else
|
||||
# define GTEST_LANG_CXX11 0
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Brings in definitions for functions used in the testing::internal::posix
|
||||
// namespace (read, write, close, chdir, isatty, stat). We do not currently
|
||||
// use them on Windows Mobile.
|
||||
@ -267,12 +282,7 @@
|
||||
// is not the case, we need to include headers that provide the functions
|
||||
// mentioned above.
|
||||
# include <unistd.h>
|
||||
# if !GTEST_OS_NACL
|
||||
// TODO(vladl@google.com): Remove this condition when Native Client SDK adds
|
||||
// strings.h (tracked in
|
||||
// http://code.google.com/p/nativeclient/issues/detail?id=1175).
|
||||
# include <strings.h> // Native Client doesn't provide strings.h.
|
||||
# endif
|
||||
# include <strings.h>
|
||||
#elif !GTEST_OS_WINDOWS_MOBILE
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
@ -466,15 +476,28 @@
|
||||
// The user didn't tell us, so we need to figure it out.
|
||||
|
||||
// We use our own TR1 tuple if we aren't sure the user has an
|
||||
// implementation of it already. At this time, GCC 4.0.0+ and MSVC
|
||||
// 2010 are the only mainstream compilers that come with a TR1 tuple
|
||||
// implementation. NVIDIA's CUDA NVCC compiler pretends to be GCC by
|
||||
// defining __GNUC__ and friends, but cannot compile GCC's tuple
|
||||
// implementation. MSVC 2008 (9.0) provides TR1 tuple in a 323 MB
|
||||
// Feature Pack download, which we cannot assume the user has.
|
||||
// QNX's QCC compiler is a modified GCC but it doesn't support TR1 tuple.
|
||||
// implementation of it already. At this time, libstdc++ 4.0.0+ and
|
||||
// MSVC 2010 are the only mainstream standard libraries that come
|
||||
// with a TR1 tuple implementation. NVIDIA's CUDA NVCC compiler
|
||||
// pretends to be GCC by defining __GNUC__ and friends, but cannot
|
||||
// compile GCC's tuple implementation. MSVC 2008 (9.0) provides TR1
|
||||
// tuple in a 323 MB Feature Pack download, which we cannot assume the
|
||||
// user has. QNX's QCC compiler is a modified GCC but it doesn't
|
||||
// support TR1 tuple. libc++ only provides std::tuple, in C++11 mode,
|
||||
// and it can be used with some compilers that define __GNUC__.
|
||||
# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000) \
|
||||
&& !GTEST_OS_QNX) || _MSC_VER >= 1600
|
||||
&& !GTEST_OS_QNX && !defined(_LIBCPP_VERSION)) || _MSC_VER >= 1600
|
||||
# define GTEST_ENV_HAS_TR1_TUPLE_ 1
|
||||
# endif
|
||||
|
||||
// C++11 specifies that <tuple> provides std::tuple. Users can't use
|
||||
// gtest in C++11 mode until their standard library is at least that
|
||||
// compliant.
|
||||
# if GTEST_LANG_CXX11
|
||||
# define GTEST_ENV_HAS_STD_TUPLE_ 1
|
||||
# endif
|
||||
|
||||
# if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_
|
||||
# define GTEST_USE_OWN_TR1_TUPLE 0
|
||||
# else
|
||||
# define GTEST_USE_OWN_TR1_TUPLE 1
|
||||
@ -489,6 +512,22 @@
|
||||
|
||||
# if GTEST_USE_OWN_TR1_TUPLE
|
||||
# include "gtest/internal/gtest-tuple.h"
|
||||
# elif GTEST_ENV_HAS_STD_TUPLE_
|
||||
# include <tuple>
|
||||
// C++11 puts its tuple into the ::std namespace rather than
|
||||
// ::std::tr1. gtest expects tuple to live in ::std::tr1, so put it there.
|
||||
// This causes undefined behavior, but supported compilers react in
|
||||
// the way we intend.
|
||||
namespace std {
|
||||
namespace tr1 {
|
||||
using ::std::get;
|
||||
using ::std::make_tuple;
|
||||
using ::std::tuple;
|
||||
using ::std::tuple_element;
|
||||
using ::std::tuple_size;
|
||||
}
|
||||
}
|
||||
|
||||
# elif GTEST_OS_SYMBIAN
|
||||
|
||||
// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
|
||||
|
@ -39,8 +39,8 @@
|
||||
#elif GTEST_OS_WINDOWS
|
||||
# include <direct.h>
|
||||
# include <io.h>
|
||||
#elif GTEST_OS_SYMBIAN || GTEST_OS_NACL
|
||||
// Symbian OpenC and NaCl have PATH_MAX in sys/syslimits.h
|
||||
#elif GTEST_OS_SYMBIAN
|
||||
// Symbian OpenC has PATH_MAX in sys/syslimits.h
|
||||
# include <sys/syslimits.h>
|
||||
#else
|
||||
# include <limits.h>
|
||||
|
Loading…
x
Reference in New Issue
Block a user