diff options
Diffstat (limited to 'include/gtest/internal')
-rw-r--r-- | include/gtest/internal/gtest-death-test-internal.h | 16 | ||||
-rw-r--r-- | include/gtest/internal/gtest-internal.h | 19 | ||||
-rw-r--r-- | include/gtest/internal/gtest-param-util-generated.h | 4 | ||||
-rw-r--r-- | include/gtest/internal/gtest-param-util-generated.h.pump | 4 | ||||
-rw-r--r-- | include/gtest/internal/gtest-port.h | 324 | ||||
-rw-r--r-- | include/gtest/internal/gtest-string.h | 2 | ||||
-rw-r--r-- | include/gtest/internal/gtest-tuple.h | 4 | ||||
-rw-r--r-- | include/gtest/internal/gtest-tuple.h.pump | 4 | ||||
-rw-r--r-- | include/gtest/internal/gtest-type-util.h | 24 | ||||
-rw-r--r-- | include/gtest/internal/gtest-type-util.h.pump | 24 |
10 files changed, 221 insertions, 204 deletions
diff --git a/include/gtest/internal/gtest-death-test-internal.h b/include/gtest/internal/gtest-death-test-internal.h index 2b2c98d6..1d9f83b6 100644 --- a/include/gtest/internal/gtest-death-test-internal.h +++ b/include/gtest/internal/gtest-death-test-internal.h @@ -157,8 +157,8 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status); // Traps C++ exceptions escaping statement and reports them as test // failures. Note that trapping SEH exceptions is not implemented here. -#if GTEST_HAS_EXCEPTIONS -#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ +# if GTEST_HAS_EXCEPTIONS +# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ try { \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement); \ } catch (const ::std::exception& gtest_exception) { \ @@ -173,14 +173,16 @@ GTEST_API_ bool ExitedUnsuccessfully(int exit_status); } catch (...) { \ death_test->Abort(::testing::internal::DeathTest::TEST_THREW_EXCEPTION); \ } -#else -#define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ + +# else +# define GTEST_EXECUTE_DEATH_TEST_STATEMENT_(statement, death_test) \ GTEST_SUPPRESS_UNREACHABLE_CODE_WARNING_BELOW_(statement) -#endif + +# endif // This macro is for implementing ASSERT_DEATH*, EXPECT_DEATH*, // ASSERT_EXIT*, and EXPECT_EXIT*. -#define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \ +# define GTEST_DEATH_TEST_(statement, predicate, regex, fail) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ const ::testing::internal::RE& gtest_regex = (regex); \ @@ -285,7 +287,7 @@ InternalRunDeathTestFlag* ParseInternalRunDeathTestFlag(); // statement unconditionally returns or throws. The Message constructor at // the end allows the syntax of streaming additional messages into the // macro, for compilational compatibility with EXPECT_DEATH/ASSERT_DEATH. -#define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \ +# define GTEST_UNSUPPORTED_DEATH_TEST_(statement, regex, terminator) \ GTEST_AMBIGUOUS_ELSE_BLOCKER_ \ if (::testing::internal::AlwaysTrue()) { \ GTEST_LOG_(WARNING) \ diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 9f890faa..db098a49 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -40,10 +40,10 @@ #include "gtest/internal/gtest-port.h" #if GTEST_OS_LINUX -#include <stdlib.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <unistd.h> +# include <stdlib.h> +# include <sys/types.h> +# include <sys/wait.h> +# include <unistd.h> #endif // GTEST_OS_LINUX #include <ctype.h> @@ -156,9 +156,9 @@ char (&IsNullLiteralHelper(...))[2]; // NOLINT #ifdef GTEST_ELLIPSIS_NEEDS_POD_ // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). -#define GTEST_IS_NULL_LITERAL_(x) false +# define GTEST_IS_NULL_LITERAL_(x) false #else -#define GTEST_IS_NULL_LITERAL_(x) \ +# define GTEST_IS_NULL_LITERAL_(x) \ (sizeof(::testing::internal::IsNullLiteralHelper(x)) == 1) #endif // GTEST_ELLIPSIS_NEEDS_POD_ @@ -867,11 +867,12 @@ class ImplicitlyConvertible { // possible loss of data, so we need to temporarily disable the // warning. #ifdef _MSC_VER -#pragma warning(push) // Saves the current warning state. -#pragma warning(disable:4244) // Temporarily disables warning 4244. +# pragma warning(push) // Saves the current warning state. +# pragma warning(disable:4244) // Temporarily disables warning 4244. + static const bool value = sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1; -#pragma warning(pop) // Restores the warning state. +# pragma warning(pop) // Restores the warning state. #else static const bool value = sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1; diff --git a/include/gtest/internal/gtest-param-util-generated.h b/include/gtest/internal/gtest-param-util-generated.h index 306a5e57..c6f0ce07 100644 --- a/include/gtest/internal/gtest-param-util-generated.h +++ b/include/gtest/internal/gtest-param-util-generated.h @@ -2826,7 +2826,7 @@ class ValueArray50 { const T50 v50_; }; -#if GTEST_HAS_COMBINE +# if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced @@ -4810,7 +4810,7 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2, const Generator10 g10_; }; // class CartesianProductHolder10 -#endif // GTEST_HAS_COMBINE +# endif // GTEST_HAS_COMBINE } // namespace internal } // namespace testing diff --git a/include/gtest/internal/gtest-param-util-generated.h.pump b/include/gtest/internal/gtest-param-util-generated.h.pump index f261eb7d..c148bb1a 100644 --- a/include/gtest/internal/gtest-param-util-generated.h.pump +++ b/include/gtest/internal/gtest-param-util-generated.h.pump @@ -115,7 +115,7 @@ $for j [[ ]] -#if GTEST_HAS_COMBINE +# if GTEST_HAS_COMBINE // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE. // // Generates values from the Cartesian product of values produced @@ -291,7 +291,7 @@ $for j [[ ]] -#endif // GTEST_HAS_COMBINE +# endif // GTEST_HAS_COMBINE } // namespace internal } // namespace testing diff --git a/include/gtest/internal/gtest-port.h b/include/gtest/internal/gtest-port.h index 228c468c..042415fb 100644 --- a/include/gtest/internal/gtest-port.h +++ b/include/gtest/internal/gtest-port.h @@ -185,8 +185,8 @@ #include <stdio.h> #include <string.h> #ifndef _WIN32_WCE -#include <sys/types.h> -#include <sys/stat.h> +# include <sys/types.h> +# include <sys/stat.h> #endif // !_WIN32_WCE #include <iostream> // NOLINT @@ -203,36 +203,36 @@ // Determines the version of gcc that is used to compile this. #ifdef __GNUC__ // 40302 means version 4.3.2. -#define GTEST_GCC_VER_ \ +# define GTEST_GCC_VER_ \ (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__) #endif // __GNUC__ // Determines the platform on which Google Test is compiled. #ifdef __CYGWIN__ -#define GTEST_OS_CYGWIN 1 +# define GTEST_OS_CYGWIN 1 #elif defined __SYMBIAN32__ -#define GTEST_OS_SYMBIAN 1 +# define GTEST_OS_SYMBIAN 1 #elif defined _WIN32 -#define GTEST_OS_WINDOWS 1 -#ifdef _WIN32_WCE -#define GTEST_OS_WINDOWS_MOBILE 1 -#elif defined(__MINGW__) || defined(__MINGW32__) -#define GTEST_OS_WINDOWS_MINGW 1 -#else -#define GTEST_OS_WINDOWS_DESKTOP 1 -#endif // _WIN32_WCE +# define GTEST_OS_WINDOWS 1 +# ifdef _WIN32_WCE +# define GTEST_OS_WINDOWS_MOBILE 1 +# elif defined(__MINGW__) || defined(__MINGW32__) +# define GTEST_OS_WINDOWS_MINGW 1 +# else +# define GTEST_OS_WINDOWS_DESKTOP 1 +# endif // _WIN32_WCE #elif defined __APPLE__ -#define GTEST_OS_MAC 1 +# define GTEST_OS_MAC 1 #elif defined __linux__ -#define GTEST_OS_LINUX 1 +# define GTEST_OS_LINUX 1 #elif defined __MVS__ -#define GTEST_OS_ZOS 1 +# define GTEST_OS_ZOS 1 #elif defined(__sun) && defined(__SVR4) -#define GTEST_OS_SOLARIS 1 +# define GTEST_OS_SOLARIS 1 #elif defined(_AIX) -#define GTEST_OS_AIX 1 +# define GTEST_OS_AIX 1 #elif defined __native_client__ -#define GTEST_OS_NACL 1 +# define GTEST_OS_NACL 1 #endif // __CYGWIN__ // Brings in definitions for functions used in the testing::internal::posix @@ -242,21 +242,21 @@ // This assumes that non-Windows OSes provide unistd.h. For OSes where this // is not the case, we need to include headers that provide the functions // mentioned above. -#include <unistd.h> -#if !GTEST_OS_NACL +# 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> // Native Client doesn't provide strings.h. +# endif #elif !GTEST_OS_WINDOWS_MOBILE -#include <direct.h> -#include <io.h> +# include <direct.h> +# include <io.h> #endif // Defines this to true iff Google Test can use POSIX regular expressions. #ifndef GTEST_HAS_POSIX_RE -#define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) +# define GTEST_HAS_POSIX_RE (!GTEST_OS_WINDOWS) #endif #if GTEST_HAS_POSIX_RE @@ -265,67 +265,67 @@ // won't compile otherwise. We can #include it here as we already // included <stdlib.h>, which is guaranteed to define size_t through // <stddef.h>. -#include <regex.h> // NOLINT +# include <regex.h> // NOLINT -#define GTEST_USES_POSIX_RE 1 +# define GTEST_USES_POSIX_RE 1 #elif GTEST_OS_WINDOWS // <regex.h> is not available on Windows. Use our own simple regex // implementation instead. -#define GTEST_USES_SIMPLE_RE 1 +# define GTEST_USES_SIMPLE_RE 1 #else // <regex.h> may not be available on this platform. Use our own // simple regex implementation instead. -#define GTEST_USES_SIMPLE_RE 1 +# define GTEST_USES_SIMPLE_RE 1 #endif // GTEST_HAS_POSIX_RE #ifndef GTEST_HAS_EXCEPTIONS // The user didn't tell us whether exceptions are enabled, so we need // to figure it out. -#if defined(_MSC_VER) || defined(__BORLANDC__) +# if defined(_MSC_VER) || defined(__BORLANDC__) // MSVC's and C++Builder's implementations of the STL use the _HAS_EXCEPTIONS // macro to enable exceptions, so we'll do the same. // Assumes that exceptions are enabled by default. -#ifndef _HAS_EXCEPTIONS -#define _HAS_EXCEPTIONS 1 -#endif // _HAS_EXCEPTIONS -#define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS -#elif defined(__GNUC__) && __EXCEPTIONS +# ifndef _HAS_EXCEPTIONS +# define _HAS_EXCEPTIONS 1 +# endif // _HAS_EXCEPTIONS +# define GTEST_HAS_EXCEPTIONS _HAS_EXCEPTIONS +# elif defined(__GNUC__) && __EXCEPTIONS // gcc defines __EXCEPTIONS to 1 iff exceptions are enabled. -#define GTEST_HAS_EXCEPTIONS 1 -#elif defined(__SUNPRO_CC) +# define GTEST_HAS_EXCEPTIONS 1 +# elif defined(__SUNPRO_CC) // Sun Pro CC supports exceptions. However, there is no compile-time way of // detecting whether they are enabled or not. Therefore, we assume that // they are enabled unless the user tells us otherwise. -#define GTEST_HAS_EXCEPTIONS 1 -#elif defined(__IBMCPP__) && __EXCEPTIONS +# define GTEST_HAS_EXCEPTIONS 1 +# elif defined(__IBMCPP__) && __EXCEPTIONS // xlC defines __EXCEPTIONS to 1 iff exceptions are enabled. -#define GTEST_HAS_EXCEPTIONS 1 -#else +# define GTEST_HAS_EXCEPTIONS 1 +# else // For other compilers, we assume exceptions are disabled to be // conservative. -#define GTEST_HAS_EXCEPTIONS 0 -#endif // defined(_MSC_VER) || defined(__BORLANDC__) +# define GTEST_HAS_EXCEPTIONS 0 +# endif // defined(_MSC_VER) || defined(__BORLANDC__) #endif // GTEST_HAS_EXCEPTIONS #if !defined(GTEST_HAS_STD_STRING) // Even though we don't use this macro any longer, we keep it in case // some clients still depend on it. -#define GTEST_HAS_STD_STRING 1 +# define GTEST_HAS_STD_STRING 1 #elif !GTEST_HAS_STD_STRING // The user told us that ::std::string isn't available. -#error "Google Test cannot be used where ::std::string isn't available." +# error "Google Test cannot be used where ::std::string isn't available." #endif // !defined(GTEST_HAS_STD_STRING) #ifndef GTEST_HAS_GLOBAL_STRING // The user didn't tell us whether ::string is available, so we need // to figure it out. -#define GTEST_HAS_GLOBAL_STRING 0 +# define GTEST_HAS_GLOBAL_STRING 0 #endif // GTEST_HAS_GLOBAL_STRING @@ -337,14 +337,14 @@ // Cygwin 1.7 and below doesn't support ::std::wstring. // Solaris' libc++ doesn't support it either. -#define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS)) +# define GTEST_HAS_STD_WSTRING (!(GTEST_OS_CYGWIN || GTEST_OS_SOLARIS)) #endif // GTEST_HAS_STD_WSTRING #ifndef GTEST_HAS_GLOBAL_WSTRING // The user didn't tell us whether ::wstring is available, so we need // to figure it out. -#define GTEST_HAS_GLOBAL_WSTRING \ +# define GTEST_HAS_GLOBAL_WSTRING \ (GTEST_HAS_STD_WSTRING && GTEST_HAS_GLOBAL_STRING) #endif // GTEST_HAS_GLOBAL_WSTRING @@ -353,46 +353,46 @@ // The user didn't tell us whether RTTI is enabled, so we need to // figure it out. -#ifdef _MSC_VER +# ifdef _MSC_VER -#ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. -#define GTEST_HAS_RTTI 1 -#else -#define GTEST_HAS_RTTI 0 -#endif +# ifdef _CPPRTTI // MSVC defines this macro iff RTTI is enabled. +# define GTEST_HAS_RTTI 1 +# else +# define GTEST_HAS_RTTI 0 +# endif // Starting with version 4.3.2, gcc defines __GXX_RTTI iff RTTI is enabled. -#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) +# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40302) -#ifdef __GXX_RTTI -#define GTEST_HAS_RTTI 1 -#else -#define GTEST_HAS_RTTI 0 -#endif // __GXX_RTTI +# ifdef __GXX_RTTI +# define GTEST_HAS_RTTI 1 +# else +# define GTEST_HAS_RTTI 0 +# endif // __GXX_RTTI // Starting with version 9.0 IBM Visual Age defines __RTTI_ALL__ to 1 if // both the typeid and dynamic_cast features are present. -#elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) +# elif defined(__IBMCPP__) && (__IBMCPP__ >= 900) -#ifdef __RTTI_ALL__ -#define GTEST_HAS_RTTI 1 -#else -#define GTEST_HAS_RTTI 0 -#endif +# ifdef __RTTI_ALL__ +# define GTEST_HAS_RTTI 1 +# else +# define GTEST_HAS_RTTI 0 +# endif -#else +# else // For all other compilers, we assume RTTI is enabled. -#define GTEST_HAS_RTTI 1 +# define GTEST_HAS_RTTI 1 -#endif // _MSC_VER +# endif // _MSC_VER #endif // GTEST_HAS_RTTI // It's this header's responsibility to #include <typeinfo> when RTTI // is enabled. #if GTEST_HAS_RTTI -#include <typeinfo> +# include <typeinfo> #endif // Determines whether Google Test can use the pthreads library. @@ -402,16 +402,16 @@ // // 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) +# define GTEST_HAS_PTHREAD (GTEST_OS_LINUX || GTEST_OS_MAC) #endif // GTEST_HAS_PTHREAD #if GTEST_HAS_PTHREAD // gtest-port.h guarantees to #include <pthread.h> when GTEST_HAS_PTHREAD is // true. -#include <pthread.h> // NOLINT +# include <pthread.h> // NOLINT // For timespec and nanosleep, used below. -#include <time.h> // NOLINT +# include <time.h> // NOLINT #endif // Determines whether Google Test can use tr1/tuple. You can define @@ -419,7 +419,7 @@ // feature depending on tuple with be disabled in this mode). #ifndef GTEST_HAS_TR1_TUPLE // The user didn't tell us not to do it, so we assume it's OK. -#define GTEST_HAS_TR1_TUPLE 1 +# define GTEST_HAS_TR1_TUPLE 1 #endif // GTEST_HAS_TR1_TUPLE // Determines whether Google Test's own tr1 tuple implementation @@ -434,12 +434,12 @@ // 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. -#if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \ +# if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \ || _MSC_VER >= 1600 -#define GTEST_USE_OWN_TR1_TUPLE 0 -#else -#define GTEST_USE_OWN_TR1_TUPLE 1 -#endif +# define GTEST_USE_OWN_TR1_TUPLE 0 +# else +# define GTEST_USE_OWN_TR1_TUPLE 1 +# endif #endif // GTEST_USE_OWN_TR1_TUPLE @@ -448,47 +448,47 @@ // tr1/tuple. #if GTEST_HAS_TR1_TUPLE -#if GTEST_USE_OWN_TR1_TUPLE -#include "gtest/internal/gtest-tuple.h" -#elif GTEST_OS_SYMBIAN +# if GTEST_USE_OWN_TR1_TUPLE +# include "gtest/internal/gtest-tuple.h" +# elif GTEST_OS_SYMBIAN // On Symbian, BOOST_HAS_TR1_TUPLE causes Boost's TR1 tuple library to // use STLport's tuple implementation, which unfortunately doesn't // work as the copy of STLport distributed with Symbian is incomplete. // By making sure BOOST_HAS_TR1_TUPLE is undefined, we force Boost to // use its own tuple implementation. -#ifdef BOOST_HAS_TR1_TUPLE -#undef BOOST_HAS_TR1_TUPLE -#endif // BOOST_HAS_TR1_TUPLE +# ifdef BOOST_HAS_TR1_TUPLE +# undef BOOST_HAS_TR1_TUPLE +# endif // BOOST_HAS_TR1_TUPLE // This prevents <boost/tr1/detail/config.hpp>, which defines // BOOST_HAS_TR1_TUPLE, from being #included by Boost's <tuple>. -#define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED -#include <tuple> +# define BOOST_TR1_DETAIL_CONFIG_HPP_INCLUDED +# include <tuple> -#elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) +# elif defined(__GNUC__) && (GTEST_GCC_VER_ >= 40000) // GCC 4.0+ implements tr1/tuple in the <tr1/tuple> header. This does // not conform to the TR1 spec, which requires the header to be <tuple>. -#if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 +# if !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 // Until version 4.3.2, gcc has a bug that causes <tr1/functional>, // which is #included by <tr1/tuple>, to not compile when RTTI is // disabled. _TR1_FUNCTIONAL is the header guard for // <tr1/functional>. Hence the following #define is a hack to prevent // <tr1/functional> from being included. -#define _TR1_FUNCTIONAL 1 -#include <tr1/tuple> -#undef _TR1_FUNCTIONAL // Allows the user to #include +# define _TR1_FUNCTIONAL 1 +# include <tr1/tuple> +# undef _TR1_FUNCTIONAL // Allows the user to #include // <tr1/functional> if he chooses to. -#else -#include <tr1/tuple> // NOLINT -#endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 +# else +# include <tr1/tuple> // NOLINT +# endif // !GTEST_HAS_RTTI && GTEST_GCC_VER_ < 40302 -#else +# else // If the compiler is not GCC 4.0+, we assume the user is using a // spec-conforming TR1 implementation. -#include <tuple> // NOLINT -#endif // GTEST_USE_OWN_TR1_TUPLE +# include <tuple> // NOLINT +# endif // GTEST_USE_OWN_TR1_TUPLE #endif // GTEST_HAS_TR1_TUPLE @@ -499,11 +499,11 @@ #ifndef GTEST_HAS_CLONE // The user didn't tell us, so we need to figure it out. -#if GTEST_OS_LINUX && !defined(__ia64__) -#define GTEST_HAS_CLONE 1 -#else -#define GTEST_HAS_CLONE 0 -#endif // GTEST_OS_LINUX && !defined(__ia64__) +# if GTEST_OS_LINUX && !defined(__ia64__) +# define GTEST_HAS_CLONE 1 +# else +# define GTEST_HAS_CLONE 0 +# endif // GTEST_OS_LINUX && !defined(__ia64__) #endif // GTEST_HAS_CLONE @@ -512,11 +512,11 @@ #ifndef GTEST_HAS_STREAM_REDIRECTION // By default, we assume that stream redirection is supported on all // platforms except known mobile ones. -#if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN -#define GTEST_HAS_STREAM_REDIRECTION 0 -#else -#define GTEST_HAS_STREAM_REDIRECTION 1 -#endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN +# if GTEST_OS_WINDOWS_MOBILE || GTEST_OS_SYMBIAN +# define GTEST_HAS_STREAM_REDIRECTION 0 +# else +# define GTEST_HAS_STREAM_REDIRECTION 1 +# endif // !GTEST_OS_WINDOWS_MOBILE && !GTEST_OS_SYMBIAN #endif // GTEST_HAS_STREAM_REDIRECTION // Determines whether to support death tests. @@ -526,8 +526,8 @@ #if (GTEST_OS_LINUX || GTEST_OS_MAC || GTEST_OS_CYGWIN || GTEST_OS_SOLARIS || \ (GTEST_OS_WINDOWS_DESKTOP && _MSC_VER >= 1400) || \ GTEST_OS_WINDOWS_MINGW || GTEST_OS_AIX) -#define GTEST_HAS_DEATH_TEST 1 -#include <vector> // NOLINT +# define GTEST_HAS_DEATH_TEST 1 +# include <vector> // NOLINT #endif // We don't support MSVC 7.1 with exceptions disabled now. Therefore @@ -541,8 +541,8 @@ // Sun Pro CC, and IBM Visual Age support. #if defined(__GNUC__) || (_MSC_VER >= 1400) || defined(__SUNPRO_CC) || \ defined(__IBMCPP__) -#define GTEST_HAS_TYPED_TEST 1 -#define GTEST_HAS_TYPED_TEST_P 1 +# define GTEST_HAS_TYPED_TEST 1 +# define GTEST_HAS_TYPED_TEST_P 1 #endif // Determines whether to support Combine(). This only makes sense when @@ -550,7 +550,7 @@ // work on Sun Studio since it doesn't understand templated conversion // operators. #if GTEST_HAS_PARAM_TEST && GTEST_HAS_TR1_TUPLE && !defined(__SUNPRO_CC) -#define GTEST_HAS_COMBINE 1 +# define GTEST_HAS_COMBINE 1 #endif // Determines whether the system compiler uses UTF-16 for encoding wide strings. @@ -559,7 +559,7 @@ // Determines whether test results can be streamed to a socket. #if GTEST_OS_LINUX -#define GTEST_CAN_STREAM_RESULTS_ 1 +# define GTEST_CAN_STREAM_RESULTS_ 1 #endif // Defines some utility macros. @@ -573,9 +573,9 @@ // // The "switch (0) case 0:" idiom is used to suppress this. #ifdef __INTEL_COMPILER -#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ +# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ #else -#define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT +# define GTEST_AMBIGUOUS_ELSE_BLOCKER_ switch (0) case 0: default: // NOLINT #endif // Use this annotation at the end of a struct/class definition to @@ -590,9 +590,9 @@ // Also use it after a variable or parameter declaration to tell the // compiler the variable/parameter does not have to be used. #if defined(__GNUC__) && !defined(COMPILER_ICC) -#define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) +# define GTEST_ATTRIBUTE_UNUSED_ __attribute__ ((unused)) #else -#define GTEST_ATTRIBUTE_UNUSED_ +# define GTEST_ATTRIBUTE_UNUSED_ #endif // A macro to disallow operator= @@ -612,9 +612,9 @@ // // Sprocket* AllocateSprocket() GTEST_MUST_USE_RESULT_; #if defined(__GNUC__) && (GTEST_GCC_VER_ >= 30400) && !defined(COMPILER_ICC) -#define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) +# define GTEST_MUST_USE_RESULT_ __attribute__ ((warn_unused_result)) #else -#define GTEST_MUST_USE_RESULT_ +# define GTEST_MUST_USE_RESULT_ #endif // __GNUC__ && (GTEST_GCC_VER_ >= 30400) && !COMPILER_ICC // Determine whether the compiler supports Microsoft's Structured Exception @@ -623,28 +623,28 @@ #ifndef GTEST_HAS_SEH // The user didn't tell us, so we need to figure it out. -#if defined(_MSC_VER) || defined(__BORLANDC__) +# if defined(_MSC_VER) || defined(__BORLANDC__) // These two compilers are known to support SEH. -#define GTEST_HAS_SEH 1 -#else +# define GTEST_HAS_SEH 1 +# else // Assume no SEH. -#define GTEST_HAS_SEH 0 -#endif +# define GTEST_HAS_SEH 0 +# endif #endif // GTEST_HAS_SEH #ifdef _MSC_VER -#if GTEST_LINKED_AS_SHARED_LIBRARY -#define GTEST_API_ __declspec(dllimport) -#elif GTEST_CREATE_SHARED_LIBRARY -#define GTEST_API_ __declspec(dllexport) -#endif +# if GTEST_LINKED_AS_SHARED_LIBRARY +# define GTEST_API_ __declspec(dllimport) +# elif GTEST_CREATE_SHARED_LIBRARY +# define GTEST_API_ __declspec(dllexport) +# endif #endif // _MSC_VER #ifndef GTEST_API_ -#define GTEST_API_ +# define GTEST_API_ #endif namespace testing { @@ -794,7 +794,9 @@ class GTEST_API_ RE { RE(const ::std::string& regex) { Init(regex.c_str()); } // NOLINT #if GTEST_HAS_GLOBAL_STRING + RE(const ::string& regex) { Init(regex.c_str()); } // NOLINT + #endif // GTEST_HAS_GLOBAL_STRING RE(const char* regex) { Init(regex); } // NOLINT @@ -818,12 +820,14 @@ class GTEST_API_ RE { } #if GTEST_HAS_GLOBAL_STRING + static bool FullMatch(const ::string& str, const RE& re) { return FullMatch(str.c_str(), re); } static bool PartialMatch(const ::string& str, const RE& re) { return PartialMatch(str.c_str(), re); } + #endif // GTEST_HAS_GLOBAL_STRING static bool FullMatch(const char* str, const RE& re); @@ -838,11 +842,16 @@ class GTEST_API_ RE { // files. const char* pattern_; bool is_valid_; + #if GTEST_USES_POSIX_RE + regex_t full_regex_; // For FullMatch(). regex_t partial_regex_; // For PartialMatch(). + #else // GTEST_USES_SIMPLE_RE + const char* full_pattern_; // For FullMatch(); + #endif GTEST_DISALLOW_ASSIGN_(RE); @@ -1205,11 +1214,11 @@ class MutexBase { }; // Forward-declares a static mutex. -#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ +# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::MutexBase mutex // Defines and statically (i.e. at link time) initializes a static mutex. -#define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ +# define GTEST_DEFINE_STATIC_MUTEX_(mutex) \ ::testing::internal::MutexBase mutex = { PTHREAD_MUTEX_INITIALIZER, 0 } // The Mutex class can only be used for mutexes created at runtime. It @@ -1356,7 +1365,7 @@ class ThreadLocal { GTEST_DISALLOW_COPY_AND_ASSIGN_(ThreadLocal); }; -#define GTEST_IS_THREADSAFE 1 +# define GTEST_IS_THREADSAFE 1 #else // GTEST_HAS_PTHREAD @@ -1371,10 +1380,10 @@ class Mutex { void AssertHeld() const {} }; -#define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ +# define GTEST_DECLARE_STATIC_MUTEX_(mutex) \ extern ::testing::internal::Mutex mutex -#define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex +# define GTEST_DEFINE_STATIC_MUTEX_(mutex) ::testing::internal::Mutex mutex class GTestMutexLock { public: @@ -1398,7 +1407,7 @@ class ThreadLocal { // The above synchronization primitives have dummy implementations. // Therefore Google Test is not thread-safe. -#define GTEST_IS_THREADSAFE 0 +# define GTEST_IS_THREADSAFE 0 #endif // GTEST_HAS_PTHREAD @@ -1415,9 +1424,9 @@ GTEST_API_ size_t GetThreadCount(); #if defined(__SYMBIAN32__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) // We lose support for NULL detection where the compiler doesn't like // passing non-POD classes through ellipsis (...). -#define GTEST_ELLIPSIS_NEEDS_POD_ 1 +# define GTEST_ELLIPSIS_NEEDS_POD_ 1 #else -#define GTEST_CAN_COMPARE_NULL 1 +# define GTEST_CAN_COMPARE_NULL 1 #endif // The Nokia Symbian and IBM XL C/C++ compilers cannot decide between @@ -1425,7 +1434,7 @@ GTEST_API_ size_t GetThreadCount(); // _can_ decide between class template specializations for T and T*, // so a tr1::type_traits-like is_pointer works. #if defined(__SYMBIAN32__) || defined(__IBMCPP__) -#define GTEST_NEEDS_IS_POINTER_ 1 +# define GTEST_NEEDS_IS_POINTER_ 1 #endif template <bool bool_value> @@ -1445,13 +1454,13 @@ template <typename T> struct is_pointer<T*> : public true_type {}; #if GTEST_OS_WINDOWS -#define GTEST_PATH_SEP_ "\\" -#define GTEST_HAS_ALT_PATH_SEP_ 1 +# define GTEST_PATH_SEP_ "\\" +# define GTEST_HAS_ALT_PATH_SEP_ 1 // The biggest signed integer type the compiler supports. typedef __int64 BiggestInt; #else -#define GTEST_PATH_SEP_ "/" -#define GTEST_HAS_ALT_PATH_SEP_ 0 +# define GTEST_PATH_SEP_ "/" +# define GTEST_HAS_ALT_PATH_SEP_ 0 typedef long long BiggestInt; // NOLINT #endif // GTEST_OS_WINDOWS @@ -1505,36 +1514,36 @@ namespace posix { typedef struct _stat StatStruct; -#ifdef __BORLANDC__ +# ifdef __BORLANDC__ inline int IsATTY(int fd) { return isatty(fd); } inline int StrCaseCmp(const char* s1, const char* s2) { return stricmp(s1, s2); } inline char* StrDup(const char* src) { return strdup(src); } -#else // !__BORLANDC__ -#if GTEST_OS_WINDOWS_MOBILE +# else // !__BORLANDC__ +# if GTEST_OS_WINDOWS_MOBILE inline int IsATTY(int /* fd */) { return 0; } -#else +# else inline int IsATTY(int fd) { return _isatty(fd); } -#endif // GTEST_OS_WINDOWS_MOBILE +# endif // GTEST_OS_WINDOWS_MOBILE inline int StrCaseCmp(const char* s1, const char* s2) { return _stricmp(s1, s2); } inline char* StrDup(const char* src) { return _strdup(src); } -#endif // __BORLANDC__ +# endif // __BORLANDC__ -#if GTEST_OS_WINDOWS_MOBILE +# if GTEST_OS_WINDOWS_MOBILE inline int FileNo(FILE* file) { return reinterpret_cast<int>(_fileno(file)); } // Stat(), RmDir(), and IsDir() are not needed on Windows CE at this // time and thus not defined there. -#else +# else inline int FileNo(FILE* file) { return _fileno(file); } inline int Stat(const char* path, StatStruct* buf) { return _stat(path, buf); } inline int RmDir(const char* dir) { return _rmdir(dir); } inline bool IsDir(const StatStruct& st) { return (_S_IFDIR & st.st_mode) != 0; } -#endif // GTEST_OS_WINDOWS_MOBILE +# endif // GTEST_OS_WINDOWS_MOBILE #else @@ -1556,8 +1565,8 @@ inline bool IsDir(const StatStruct& st) { return S_ISDIR(st.st_mode); } #ifdef _MSC_VER // Temporarily disable warning 4996 (deprecated function). -#pragma warning(push) -#pragma warning(disable:4996) +# pragma warning(push) +# pragma warning(disable:4996) #endif inline const char* StrNCpy(char* dest, const char* src, size_t n) { @@ -1606,7 +1615,7 @@ inline const char* GetEnv(const char* name) { } #ifdef _MSC_VER -#pragma warning(pop) // Restores the warning state. +# pragma warning(pop) // Restores the warning state. #endif #if GTEST_OS_WINDOWS_MOBILE @@ -1672,6 +1681,7 @@ class TypeWithSize<4> { template <> class TypeWithSize<8> { public: + #if GTEST_OS_WINDOWS typedef __int64 Int; typedef unsigned __int64 UInt; diff --git a/include/gtest/internal/gtest-string.h b/include/gtest/internal/gtest-string.h index 8cbb7978..efde52a9 100644 --- a/include/gtest/internal/gtest-string.h +++ b/include/gtest/internal/gtest-string.h @@ -43,7 +43,7 @@ #ifdef __BORLANDC__ // string.h is not guaranteed to provide strcpy on C++ Builder. -#include <mem.h> +# include <mem.h> #endif #include <string.h> diff --git a/include/gtest/internal/gtest-tuple.h b/include/gtest/internal/gtest-tuple.h index 16178fc0..d1af50e1 100644 --- a/include/gtest/internal/gtest-tuple.h +++ b/include/gtest/internal/gtest-tuple.h @@ -44,9 +44,9 @@ // private as public. // Sun Studio versions < 12 also have the above bug. #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) -#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: +# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: #else -#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ +# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ template <GTEST_10_TYPENAMES_(U)> friend class tuple; \ private: #endif diff --git a/include/gtest/internal/gtest-tuple.h.pump b/include/gtest/internal/gtest-tuple.h.pump index 85ebc806..ef519094 100644 --- a/include/gtest/internal/gtest-tuple.h.pump +++ b/include/gtest/internal/gtest-tuple.h.pump @@ -45,9 +45,9 @@ $$ This meta comment fixes auto-indentation in Emacs. }} // private as public. // Sun Studio versions < 12 also have the above bug. #if defined(__SYMBIAN32__) || (defined(__SUNPRO_CC) && __SUNPRO_CC < 0x590) -#define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: +# define GTEST_DECLARE_TUPLE_AS_FRIEND_ public: #else -#define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ +# define GTEST_DECLARE_TUPLE_AS_FRIEND_ \ template <GTEST_$(n)_TYPENAMES_(U)> friend class tuple; \ private: #endif diff --git a/include/gtest/internal/gtest-type-util.h b/include/gtest/internal/gtest-type-util.h index 7a986461..49b85ca2 100644 --- a/include/gtest/internal/gtest-type-util.h +++ b/include/gtest/internal/gtest-type-util.h @@ -51,9 +51,9 @@ // #ifdef __GNUC__ is too general here. It is possible to use gcc without using // libstdc++ (which is where cxxabi.h comes from). -#ifdef __GLIBCXX__ -#include <cxxabi.h> -#endif // __GLIBCXX__ +# ifdef __GLIBCXX__ +# include <cxxabi.h> +# endif // __GLIBCXX__ namespace testing { namespace internal { @@ -73,10 +73,10 @@ struct AssertTypeEq<T, T> { // GetTypeName<T>() returns a human-readable name of type T. template <typename T> String GetTypeName() { -#if GTEST_HAS_RTTI +# if GTEST_HAS_RTTI const char* const name = typeid(T).name(); -#ifdef __GLIBCXX__ +# ifdef __GLIBCXX__ int status = 0; // gcc's implementation of typeid(T).name() mangles the type name, // so we have to demangle it. @@ -84,13 +84,15 @@ String GetTypeName() { const String name_str(status == 0 ? readable_name : name); free(readable_name); return name_str; -#else +# else return name; -#endif // __GLIBCXX__ +# endif // __GLIBCXX__ + +# else -#else return "<type>"; -#endif // GTEST_HAS_RTTI + +# endif // GTEST_HAS_RTTI } // A unique type used as the default value for the arguments of class @@ -1611,7 +1613,7 @@ struct Types<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, namespace internal { -#define GTEST_TEMPLATE_ template <typename T> class +# define GTEST_TEMPLATE_ template <typename T> class // The template "selector" struct TemplateSel<Tmpl> is used to // represent Tmpl, which must be a class template with one type @@ -1629,7 +1631,7 @@ struct TemplateSel { }; }; -#define GTEST_BIND_(TmplSel, T) \ +# define GTEST_BIND_(TmplSel, T) \ TmplSel::template Bind<T>::type // A unique struct template used as the default value for the diff --git a/include/gtest/internal/gtest-type-util.h.pump b/include/gtest/internal/gtest-type-util.h.pump index 04906b77..0caab21b 100644 --- a/include/gtest/internal/gtest-type-util.h.pump +++ b/include/gtest/internal/gtest-type-util.h.pump @@ -49,9 +49,9 @@ $var n = 50 $$ Maximum length of type lists we want to support. // #ifdef __GNUC__ is too general here. It is possible to use gcc without using // libstdc++ (which is where cxxabi.h comes from). -#ifdef __GLIBCXX__ -#include <cxxabi.h> -#endif // __GLIBCXX__ +# ifdef __GLIBCXX__ +# include <cxxabi.h> +# endif // __GLIBCXX__ namespace testing { namespace internal { @@ -71,10 +71,10 @@ struct AssertTypeEq<T, T> { // GetTypeName<T>() returns a human-readable name of type T. template <typename T> String GetTypeName() { -#if GTEST_HAS_RTTI +# if GTEST_HAS_RTTI const char* const name = typeid(T).name(); -#ifdef __GLIBCXX__ +# ifdef __GLIBCXX__ int status = 0; // gcc's implementation of typeid(T).name() mangles the type name, // so we have to demangle it. @@ -82,13 +82,15 @@ String GetTypeName() { const String name_str(status == 0 ? readable_name : name); free(readable_name); return name_str; -#else +# else return name; -#endif // __GLIBCXX__ +# endif // __GLIBCXX__ + +# else -#else return "<type>"; -#endif // GTEST_HAS_RTTI + +# endif // GTEST_HAS_RTTI } // A unique type used as the default value for the arguments of class @@ -169,7 +171,7 @@ struct Types<$for j, [[T$j]]$for k[[, internal::None]]> { namespace internal { -#define GTEST_TEMPLATE_ template <typename T> class +# define GTEST_TEMPLATE_ template <typename T> class // The template "selector" struct TemplateSel<Tmpl> is used to // represent Tmpl, which must be a class template with one type @@ -187,7 +189,7 @@ struct TemplateSel { }; }; -#define GTEST_BIND_(TmplSel, T) \ +# define GTEST_BIND_(TmplSel, T) \ TmplSel::template Bind<T>::type // A unique struct template used as the default value for the |