[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 05:37:22 PDT 2021


uabelho created this revision.
Herald added a subscriber: bjope.
uabelho requested review of this revision.
Herald added a project: LLVM.

This is needed after

  https://reviews.llvm.org/rG9658d045926545e62cc3f963fe611d7c5d0c9d98

which introduced code that at least didn't compile clean with clang 8.


Repository:
  rG LLVM Github Monorepo

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
@@ -54,7 +54,7 @@
 
 #if GTEST_HAS_PARAM_TEST
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-copy"
 #endif
@@ -5146,7 +5146,7 @@
 }  // namespace internal
 }  // namespace testing
 
-#ifdef __clang__
+#if defined(__clang__) &&  __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
 
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
@@ -55,7 +55,7 @@
 //
 // where all clauses are optional and WillOnce() can be repeated.
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-copy"
 #endif
@@ -96,7 +96,7 @@
 
 }  // namespace testing
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #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
@@ -58,7 +58,7 @@
 # include <initializer_list>  // NOLINT -- must be after gtest.h
 #endif
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wdeprecated-copy"
 #endif
@@ -4421,7 +4421,7 @@
 
 }  // namespace testing
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
 


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


More information about the llvm-commits mailing list