[PATCH] D101288: Only ignore -Wdeprecated-copy if the used compiler supports the warning

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 08:41:35 PDT 2021


uabelho updated this revision to Diff 340537.
uabelho added a comment.

Use
 #ifdef __clang__
 #if __has_warning("-Wdeprecated-copy")
instead of 
#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
as the latter seems to break gcc bots.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101288/new/

https://reviews.llvm.org/D101288

Files:
  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: llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h
===================================================================
--- llvm/utils/unittest/googletest/include/gtest/internal/gtest-param-util-generated.h
+++ 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 @@
 }  // namespace testing
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
+#endif
 
 #endif  //  GTEST_HAS_PARAM_TEST
 
Index: llvm/utils/unittest/googlemock/include/gmock/gmock.h
===================================================================
--- llvm/utils/unittest/googlemock/include/gmock/gmock.h
+++ 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 @@
 }  // namespace testing
 
 #ifdef __clang__
+#if __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
+#endif
 #endif  // GMOCK_INCLUDE_GMOCK_GMOCK_H_
Index: llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
===================================================================
--- llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
+++ 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 @@
 }  // 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101288.340537.patch
Type: text/x-patch
Size: 2293 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210426/f0f7b223/attachment-0001.bin>


More information about the llvm-commits mailing list