From c35ad8d4a3e4b9c907b6a5bbceaff91aebf7c3c8 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 4 Jan 2016 23:54:02 +0500 Subject: GTest: Fix some strict compiler warnings Those changes are to be backported to the upstream actually, for until then it should be good enough to have it locally. --- extern/gtest/include/gtest/gtest.h | 18 +++++++-------- extern/gtest/include/gtest/internal/gtest-port.h | 28 ++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 11 deletions(-) (limited to 'extern') diff --git a/extern/gtest/include/gtest/gtest.h b/extern/gtest/include/gtest/gtest.h index 6fa0a3925e7..69a8e72da5f 100644 --- a/extern/gtest/include/gtest/gtest.h +++ b/extern/gtest/include/gtest/gtest.h @@ -1873,7 +1873,7 @@ class TestWithParam : public Test, public WithParamInterface { // Define this macro to 1 to omit the definition of FAIL(), which is a // generic name and clashes with some other libraries. -#if !GTEST_DONT_DEFINE_FAIL +#if !defined(GTEST_DONT_DEFINE_FAIL) || !GTEST_DONT_DEFINE_FAIL # define FAIL() GTEST_FAIL() #endif @@ -1882,7 +1882,7 @@ class TestWithParam : public Test, public WithParamInterface { // Define this macro to 1 to omit the definition of SUCCEED(), which // is a generic name and clashes with some other libraries. -#if !GTEST_DONT_DEFINE_SUCCEED +#if !defined(GTEST_DONT_DEFINE_SUCCEED) || !GTEST_DONT_DEFINE_SUCCEED # define SUCCEED() GTEST_SUCCEED() #endif @@ -2007,27 +2007,27 @@ class TestWithParam : public Test, public WithParamInterface { // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of // ASSERT_XY(), which clashes with some users' own code. -#if !GTEST_DONT_DEFINE_ASSERT_EQ +#if !defined(GTEST_DONT_DEFINE_ASSERT_EQ) || !GTEST_DONT_DEFINE_ASSERT_EQ # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2) #endif -#if !GTEST_DONT_DEFINE_ASSERT_NE +#if !defined(GTEST_DONT_DEFINE_ASSERT_NE) || !GTEST_DONT_DEFINE_ASSERT_NE # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2) #endif -#if !GTEST_DONT_DEFINE_ASSERT_LE +#if !defined(GTEST_DONT_DEFINE_ASSERT_LE) || !GTEST_DONT_DEFINE_ASSERT_LE # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2) #endif -#if !GTEST_DONT_DEFINE_ASSERT_LT +#if !defined(GTEST_DONT_DEFINE_ASSERT_LT) || !GTEST_DONT_DEFINE_ASSERT_LT # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2) #endif -#if !GTEST_DONT_DEFINE_ASSERT_GE +#if !defined(GTEST_DONT_DEFINE_ASSERT_GE) || !GTEST_DONT_DEFINE_ASSERT_GE # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2) #endif -#if !GTEST_DONT_DEFINE_ASSERT_GT +#if !defined(GTEST_DONT_DEFINE_ASSERT_GT) || !GTEST_DONT_DEFINE_ASSERT_GT # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2) #endif @@ -2238,7 +2238,7 @@ bool StaticAssertTypeEq() { // Define this macro to 1 to omit the definition of TEST(), which // is a generic name and clashes with some other libraries. -#if !GTEST_DONT_DEFINE_TEST +#if !defined(GTEST_DONT_DEFINE_TEST) || !GTEST_DONT_DEFINE_TEST # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name) #endif diff --git a/extern/gtest/include/gtest/internal/gtest-port.h b/extern/gtest/include/gtest/internal/gtest-port.h index dc4fe0cb6b8..5ff2c29ad43 100644 --- a/extern/gtest/include/gtest/internal/gtest-port.h +++ b/extern/gtest/include/gtest/internal/gtest-port.h @@ -274,7 +274,7 @@ // -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 +# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L // Compiling in at least C++11 mode. # define GTEST_LANG_CXX11 1 # else @@ -282,6 +282,28 @@ # endif #endif +#ifndef GTEST_OS_WINDOWS +# define GTEST_OS_WINDOWS 0 +#endif +#ifndef GTEST_OS_WINDOWS_MOBILE +# define GTEST_OS_WINDOWS_MOBILE 0 +#endif +#ifndef GTEST_OS_LINUX_ANDROID +# define GTEST_OS_LINUX_ANDROID 0 +#endif +#ifndef GTEST_OS_QNX +# define GTEST_OS_QNX 0 +#endif +#ifndef GTEST_OS_SYMBIAN +# define GTEST_OS_SYMBIAN 0 +#endif +#ifndef GTEST_OS_CYGWIN +# define GTEST_OS_CYGWIN 0 +#endif +#ifndef GTEST_OS_SOLARIS +# define GTEST_OS_SOLARIS 0 +#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. @@ -527,6 +549,8 @@ // can build with clang but need to use gcc4.2's libstdc++). # if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325) # define GTEST_ENV_HAS_STD_TUPLE_ 1 +# else +# define GTEST_ENV_HAS_STD_TUPLE_ 0 # endif # if GTEST_ENV_HAS_TR1_TUPLE_ || GTEST_ENV_HAS_STD_TUPLE_ @@ -1823,7 +1847,7 @@ inline void Abort() { abort(); } // MSVC-based platforms. We map the GTEST_SNPRINTF_ macro to the appropriate // function in order to achieve that. We use macro definition here because // snprintf is a variadic function. -#if _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE +#if defined(_MSC_VER) && _MSC_VER >= 1400 && !GTEST_OS_WINDOWS_MOBILE // MSVC 2005 and above support variadic macros. # define GTEST_SNPRINTF_(buffer, size, format, ...) \ _snprintf_s(buffer, size, size, format, __VA_ARGS__) -- cgit v1.2.3