Only ignore -Wdeprecated-copy if the used compiler supports the warning
authorMikael Holmen <mikael.holmen@ericsson.com>
Tue, 27 Apr 2021 04:26:27 +0000 (06:26 +0200)
committerMikael Holmen <mikael.holmen@ericsson.com>
Tue, 27 Apr 2021 06:01:10 +0000 (08:01 +0200)
This is needed after
  https://reviews.llvm.org/rG9658d045926545e62cc3f963fe611d7c5d0c9d98
which introduced code that at least didn't compile clean with clang 8.

Differential Revision: https://reviews.llvm.org/D101288

llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
llvm/utils/unittest/googlemock/include/gmock/gmock.h
llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h

index b387c17..572872f 100644 (file)
 #endif
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-copy"
 #endif
+#endif
 
 namespace testing {
 
@@ -4422,8 +4424,10 @@ inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }
 }  // namespace testing
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
+#endif
 
 // Include any custom callback matchers added by the local installation.
 // We must include this header at the end to make sure it can use the
index 8acc461..c2ad50c 100644 (file)
 // where all clauses are optional and WillOnce() can be repeated.
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-copy"
 #endif
+#endif
 
 #include "gmock/gmock-actions.h"
 #include "gmock/gmock-cardinalities.h"
@@ -97,6 +99,8 @@ GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
 }  // namespace testing
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
+#endif
 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_H_
index df5f143..d112568 100644 (file)
 #if GTEST_HAS_PARAM_TEST
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-copy"
 #endif
+#endif
 
 namespace testing {
 
@@ -5147,8 +5149,10 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
 }  // namespace testing
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
+#endif
 
 #endif  //  GTEST_HAS_PARAM_TEST