[Bf-blender-cvs] [4d79fa8] master: Gtests: Re-apply strict compiler fixes

Sergey Sharybin noreply at git.blender.org
Fri Jul 29 22:20:01 CEST 2016


Commit: 4d79fa8382d4242340adeb922d4ad79df6d66a49
Author: Sergey Sharybin
Date:   Fri Jul 29 18:59:54 2016 +0200
Branches: master
https://developer.blender.org/rB4d79fa8382d4242340adeb922d4ad79df6d66a49

Gtests: Re-apply strict compiler fixes

===================================================================

M	extern/gtest/include/gtest/gtest-printers.h
M	extern/gtest/include/gtest/gtest.h
M	extern/gtest/include/gtest/internal/gtest-port.h

===================================================================

diff --git a/extern/gtest/include/gtest/gtest-printers.h b/extern/gtest/include/gtest/gtest-printers.h
index 8a33164..27a1edc 100644
--- a/extern/gtest/include/gtest/gtest-printers.h
+++ b/extern/gtest/include/gtest/gtest-printers.h
@@ -103,7 +103,7 @@
 #include "gtest/internal/gtest-port.h"
 #include "gtest/internal/gtest-internal.h"
 
-#if GTEST_HAS_STD_TUPLE_
+#if defined(GTEST_HAS_STD_TUPLE_) && GTEST_HAS_STD_TUPLE_
 # include <tuple>
 #endif
 
@@ -581,7 +581,7 @@ inline void PrintTo(const ::std::wstring& s, ::std::ostream* os) {
 }
 #endif  // GTEST_HAS_STD_WSTRING
 
-#if GTEST_HAS_TR1_TUPLE || GTEST_HAS_STD_TUPLE_
+#if GTEST_HAS_TR1_TUPLE || (defined(GTEST_HAS_STD_TUPLE_) && GTEST_HAS_STD_TUPLE_)
 // Helper function for printing a tuple.  T must be instantiated with
 // a tuple type.
 template <typename T>
@@ -664,7 +664,7 @@ void PrintTo(
 }
 #endif  // GTEST_HAS_TR1_TUPLE
 
-#if GTEST_HAS_STD_TUPLE_
+#if defined(GTEST_HAS_STD_TUPLE_) && GTEST_HAS_STD_TUPLE_
 template <typename... Types>
 void PrintTo(const ::std::tuple<Types...>& t, ::std::ostream* os) {
   PrintTupleTo(t, os);
@@ -888,7 +888,7 @@ template <typename TupleT>
 const size_t TuplePolicy<TupleT>::tuple_size;
 #endif  // GTEST_HAS_TR1_TUPLE
 
-#if GTEST_HAS_STD_TUPLE_
+#if defined(GTEST_HAS_STD_TUPLE_) && GTEST_HAS_STD_TUPLE_
 template <typename... Types>
 struct TuplePolicy< ::std::tuple<Types...> > {
   typedef ::std::tuple<Types...> Tuple;
diff --git a/extern/gtest/include/gtest/gtest.h b/extern/gtest/include/gtest/gtest.h
index f846c5b..18d3ed4 100644
--- a/extern/gtest/include/gtest/gtest.h
+++ b/extern/gtest/include/gtest/gtest.h
@@ -1818,7 +1818,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 
 // 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
 
@@ -1827,7 +1827,7 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 
 // 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
 
@@ -1952,27 +1952,27 @@ class TestWithParam : public Test, public WithParamInterface<T> {
 // 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
 
@@ -2183,7 +2183,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 0094ed5..ad2a43d 100644
--- a/extern/gtest/include/gtest/internal/gtest-port.h
+++ b/extern/gtest/include/gtest/internal/gtest-port.h
@@ -306,7 +306,7 @@
 //   GTEST_DISABLE_MSC_WARNINGS_PUSH_(4800 4385)
 //   /* code that triggers warnings C4800 and C4385 */
 //   GTEST_DISABLE_MSC_WARNINGS_POP_()
-#if _MSC_VER >= 1500
+#if defined(_MSC_VER) && _MSC_VER >= 1500
 # define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings) \
     __pragma(warning(push))                        \
     __pragma(warning(disable: warnings))
@@ -323,7 +323,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
@@ -352,7 +352,7 @@
 #endif
 
 // Only use C++11 library features if the library provides them.
-#if GTEST_STDLIB_CXX11
+#if defined(GTEST_STDLIB_CXX11) && GTEST_STDLIB_CXX11
 # define GTEST_HAS_STD_BEGIN_AND_END_ 1
 # define GTEST_HAS_STD_FORWARD_LIST_ 1
 # define GTEST_HAS_STD_FUNCTION_ 1
@@ -387,6 +387,37 @@
 # endif
 #endif
 
+#ifndef GTEST_OS_WINDOWS
+#  define GTEST_OS_WINDOWS 0
+#endif
+#ifndef GTEST_OS_WINDOWS_MINGW
+#  define GTEST_OS_WINDOWS_MINGW 0
+#endif
+#ifndef GTEST_OS_WINDOWS_PHONE
+#  define GTEST_OS_WINDOWS_PHONE 0
+#endif
+#ifndef GTEST_OS_WINDOWS_MOBILE
+#  define GTEST_OS_WINDOWS_MOBILE 0
+#endif
+#ifndef GTEST_OS_WINDOWS_RT
+#  define GTEST_OS_WINDOWS_RT 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.
@@ -423,7 +454,7 @@ struct _RTL_CRITICAL_SECTION;
 # endif
 #endif
 
-#if GTEST_USES_PCRE
+#if defined(GTEST_USES_PCRE) && GTEST_USES_PCRE
 // The appropriate headers have already been included.
 
 #elif GTEST_HAS_POSIX_RE
@@ -616,7 +647,7 @@ struct _RTL_CRITICAL_SECTION;
 // Determines if hash_map/hash_set are available.
 // Only used for testing against those containers.
 #if !defined(GTEST_HAS_HASH_MAP_)
-# if _MSC_VER
+# if defined(_MSC_VER)
 #  define GTEST_HAS_HASH_MAP_ 1  // Indicates that hash_map is available.
 #  define GTEST_HAS_HASH_SET_ 1  // Indicates that hash_set is available.
 # endif  // _MSC_VER
@@ -660,6 +691,8 @@ struct _RTL_CRITICAL_SECTION;
 // 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_
@@ -673,7 +706,7 @@ struct _RTL_CRITICAL_SECTION;
 // To avoid conditional compilation everywhere, we make it
 // gtest-port.h's responsibility to #include the header implementing
 // tuple.
-#if GTEST_HAS_STD_TUPLE_
+#if defined(GTEST_HAS_STD_TUPLE_) && GTEST_HAS_STD_TUPLE_
 # include <tuple>  // IWYU pragma: export
 # define GTEST_TUPLE_NAMESPACE_ ::std
 #endif  // GTEST_HAS_STD_TUPLE_
@@ -914,7 +947,7 @@ using ::std::tuple_size;
 # endif
 
 #define GTEST_IS_THREADSAFE \
-    (GTEST_HAS_MUTEX_AND_THREAD_LOCAL_ \
+    ((defined(GTEST_HAS_MUTEX_AND_THREAD_LOCAL_) && GTEST_HAS_MUTEX_AND_THREAD_LOCAL_) \
      || (GTEST_OS_WINDOWS && !GTEST_OS_WINDOWS_PHONE && !GTEST_OS_WINDOWS_RT) \
      || GTEST_HAS_PTHREAD)
 
@@ -1310,7 +1343,7 @@ inline void FlushInfoLog() { fflush(NULL); }
     GTEST_LOG_(FATAL) << #posix_call << "failed with error " \
                       << gtest_error
 
-#if GTEST_HAS_STD_MOVE_
+#if defined(GTEST_HAS_STD_MOVE_) && GTEST_HAS_STD_MOVE_
 using std::move;
 #else  // GTEST_HAS_STD_MOVE_
 template <typename T>
@@ -1394,7 +1427,7 @@ Derived* CheckedDowncastToActualType(Base* base) {
   GTEST_CHECK_(typeid(*base) == typeid(Derived));
 #endif
 
-#if GTEST_HAS_DOWNCAST_
+#if defined(GTEST_HAS_DOWNCAST_) && GTEST_HAS_DOWNCAST_
   return ::down_cast<Derived*>(base);
 #elif GTEST_HAS_RTTI
   return dynamic_cast<Derived*>(base);  // NOLINT
@@ -1454,7 +1487,7 @@ inline void SleepMilliseconds(int n) {
 }
 # endif  // GTEST_HAS_PTHREAD
 
-# if GTEST_HAS_NOTIFICATION_
+# if defined(GTEST_HAS_NOTIFICATION_) && GTEST_HAS_NOTIFICATION_
 // Notification has already been imported into the namespace.
 // Nothing to do here.
 
@@ -1637,7 +1670,7 @@ class ThreadWithParam : public ThreadWithParamBase {
 # endif  // !GTEST_OS_WINDOWS && GTEST_HAS_PTHREAD ||
          // GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
 
-# if GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
+# if defined(GTEST_HAS_MUTEX_AND_THREAD_LOCAL_) && GTEST_HAS_MUTEX_AND_THREAD_LOCAL_
 // Mutex and ThreadLocal have already been imported into the namespace.
 // Nothing to do here.
 
@@ -2417,7 +2450,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__)




More information about the Bf-blender-cvs mailing list