58
58
// GTEST_HAS_STD_WSTRING - Define it to 1/0 to indicate that
59
59
// std::wstring does/doesn't work (Google Test can
60
60
// be used where std::wstring is unavailable).
61
// GTEST_HAS_TR1_TUPLE 1 - Define it to 1/0 to indicate tr1::tuple
61
// GTEST_HAS_TR1_TUPLE - Define it to 1/0 to indicate tr1::tuple
62
62
// is/isn't available.
63
63
// GTEST_HAS_SEH - Define it to 1/0 to indicate whether the
64
64
// compiler supports Microsoft's "Structured
65
65
// Exception Handling".
66
// GTEST_USE_OWN_TR1_TUPLE - Define it to 1/0 to indicate whether Google
67
// Test's own tr1 tuple implementation should be
68
// used. Unused when the user sets
69
// GTEST_HAS_TR1_TUPLE to 0.
67
71
// This header defines the following utilities:
339
350
#define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC)
340
351
#endif // GTEST_HAS_PTHREAD
342
// Determines whether tr1/tuple is available. If you have tr1/tuple
343
// on your platform, define GTEST_HAS_TR1_TUPLE=1 for both the Google
344
// Test project and your tests. If you would like Google Test to detect
345
// tr1/tuple on your platform automatically, please open an issue
346
// ticket at http://code.google.com/p/googletest.
353
// Determines whether Google Test can use tr1/tuple. You can define
354
// this macro to 0 to prevent Google Test from using tuple (any
355
// feature depending on tuple with be disabled in this mode).
347
356
#ifndef GTEST_HAS_TR1_TUPLE
348
// The user didn't tell us, so we need to figure it out.
350
// GCC provides <tr1/tuple> since 4.0.0.
351
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
357
// The user didn't tell us not to do it, so we assume it's OK.
352
358
#define GTEST_HAS_TR1_TUPLE 1
359
#endif // GTEST_HAS_TR1_TUPLE
361
// Determines whether Google Test's own tr1 tuple implementation
363
#ifndef GTEST_USE_OWN_TR1_TUPLE
364
// The user didn't tell us, so we need to figure it out.
366
// We use our own tr1 tuple if we aren't sure the user has an
367
// implementation of it already. At this time, GCC 4.0.0+ is the only
368
// mainstream compiler that comes with a TR1 tuple implementation.
369
// MSVC 2008 (9.0) provides TR1 tuple in a 323 MB Feature Pack
370
// download, which we cannot assume the user has. MSVC 2010 isn't
372
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
373
#define GTEST_USE_OWN_TR1_TUPLE 0
354
#define GTEST_HAS_TR1_TUPLE 0
356
#endif // GTEST_HAS_TR1_TUPLE
375
#define GTEST_USE_OWN_TR1_TUPLE 1
376
#endif // defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
378
#endif // GTEST_USE_OWN_TR1_TUPLE
358
380
// To avoid conditional compilation everywhere, we make it
359
381
// gtest-port.h's responsibility to #include the header implementing
361
383
#if GTEST_HAS_TR1_TUPLE
362
#if defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
385
#if GTEST_USE_OWN_TR1_TUPLE
386
#include <gtest/internal/gtest-tuple.h>
387
#elif GTEST_OS_SYMBIAN
389
// On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to
390
// use STLport's tuple implementation, which unfortunately doesn't
391
// work as the copy of STLport distributed with Symbian is incomplete.
392
// By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to
393
// use its own tuple implementation.
394
#ifdef BOOST_HAS_TR1_TUPLE
395
#undef BOOST_HAS_TR1_TUPLE
396
#endif // BOOST_HAS_TR1_TUPLE
398
// This prevents <boost/tr1/detail/config.hpp>, which defines
399
// BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>.
400
#define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED
403
#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000)
363
404
// GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does
364
405
// not conform to the TR1 spec, which requires the header to be <tuple>.
407
#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
408
// Until version 4.3.2, gcc has a bug that causes <tr1/functional>,
409
// which is #included by <tr1/tuple>, to not compile when RTTI is
410
// disabled. _TR1_FUNCTIONAL is the header guard for
411
// <tr1/functional>. Hence the following #define is a hack to prevent
412
// <tr1/functional> from being included.
413
#define _TR1_FUNCTIONAL 1
415
#undef _TR1_FUNCTIONAL // Allows the user to #include
416
// <tr1/functional> if he chooses to.
419
#endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302
367
422
// If the compiler is not GCC 4.0+, we assume the user is using a
368
423
// spec-conforming TR1 implementation.
425
#endif // GTEST_USE_OWN_TR1_TUPLE
371
427
#endif // GTEST_HAS_TR1_TUPLE
373
429
// Determines whether clone(2) is supported.
764
819
return stricmp(s1, s2);
766
821
inline char* StrDup(const char* src) { return strdup(src); }
822
#else // !__BORLANDC__
824
inline int IsATTY(int /* fd */) { return 0; }
768
826
inline int IsATTY(int fd) { return _isatty(fd); }
769
828
inline int StrCaseCmp(const char* s1, const char* s2) {
770
829
return _stricmp(s1, s2);
772
831
inline char* StrDup(const char* src) { return _strdup(src); }
773
832
#endif // __BORLANDC__
835
inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); }
836
// Stat(), RmDir(), and IsDir() are not needed on Windows CE at this
837
// time and thus not defined there.
775
839
inline int FileNo(FILE* file) { return _fileno(file); }
776
840
inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); }
777
841
inline int RmDir(const char* dir) { return _rmdir(dir); }
778
842
inline bool IsDir(const StatStruct& st) {
779
843
return (_S_IFDIR & st.st_mode) != 0;
806
871
inline const char* StrNCpy(char* dest, const char* src, size_t n) {
807
872
return strncpy(dest, src, n);
875
// ChDir(), FReopen(), FDOpen(), Read(), Write(), Close(), and
876
// StrError() aren't needed on Windows CE at this time and thus not
809
880
inline int ChDir(const char* dir) { return chdir(dir); }
810
882
inline FILE* FOpen(const char* path, const char* mode) {
811
883
return fopen(path, mode);
813
886
inline FILE *FReopen(const char* path, const char* mode, FILE* stream) {
814
887
return freopen(path, mode, stream);
816
889
inline FILE* FDOpen(int fd, const char* mode) { return fdopen(fd, mode); }
817
891
inline int FClose(FILE* fp) { return fclose(fp); }
818
893
inline int Read(int fd, void* buf, unsigned int count) {
819
894
return static_cast<int>(read(fd, buf, count));