From 33f04e485c7d95626e12aa522b09cc81109fc6ab Mon Sep 17 00:00:00 2001 From: Mikael Holmen Date: Tue, 27 Apr 2021 06:26:27 +0200 Subject: [PATCH] Only ignore -Wdeprecated-copy if the used compiler supports the warning 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 | 4 ++++ llvm/utils/unittest/googlemock/include/gmock/gmock.h | 4 ++++ .../googletest/include/gtest/internal/gtest-param-util-generated.h | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h index b387c17..572872f 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h @@ -59,9 +59,11 @@ #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 diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock.h b/llvm/utils/unittest/googlemock/include/gmock/gmock.h index 8acc461..c2ad50c 100644 --- a/llvm/utils/unittest/googlemock/include/gmock/gmock.h +++ b/llvm/utils/unittest/googlemock/include/gmock/gmock.h @@ -56,9 +56,11 @@ // 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_ diff --git a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h index df5f143..d112568 100644 --- a/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h +++ b/llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h @@ -55,9 +55,11 @@ #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 -- 2.7.4