[llvm] 33f04e4 - Only ignore -Wdeprecated-copy if the used compiler supports the warning
Mikael Holmen via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 26 23:32:45 PDT 2021
Author: Mikael Holmen
Date: 2021-04-27T08:01:10+02:00
New Revision: 33f04e485c7d95626e12aa522b09cc81109fc6ab
URL: https://github.com/llvm/llvm-project/commit/33f04e485c7d95626e12aa522b09cc81109fc6ab
DIFF: https://github.com/llvm/llvm-project/commit/33f04e485c7d95626e12aa522b09cc81109fc6ab.diff
LOG: 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
Added:
Modified:
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
Removed:
################################################################################
diff --git a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h b/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
index b387c178fcc1..572872fd8ccc 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 8acc461b34e4..c2ad50cd8e64 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 df5f143604bb..d112568166ef 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
More information about the llvm-commits
mailing list