[llvm] b125c03 - Only ignore -Wdeprecated-copy if the used compiler supports the warning

Dávid Bolvanský via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 26 07:01:05 PDT 2021


Author: Dávid Bolvanský
Date: 2021-04-26T16:00:54+02:00
New Revision: b125c034af89e32d5258d593080ff0c4810776a0

URL: https://github.com/llvm/llvm-project/commit/b125c034af89e32d5258d593080ff0c4810776a0
DIFF: https://github.com/llvm/llvm-project/commit/b125c034af89e32d5258d593080ff0c4810776a0.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.

Reviewed By: xbolva00

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 b387c178fcc16..ee2b4e4729a0c 100644
--- a/llvm/utils/unittest/googlemock/include/gmock/gmock-matchers.h
+++ b/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 @@ inline InnerMatcher AllArgs(const InnerMatcher& matcher) { return matcher; }
 
 }  // namespace testing
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
 

diff  --git a/llvm/utils/unittest/googlemock/include/gmock/gmock.h b/llvm/utils/unittest/googlemock/include/gmock/gmock.h
index 8acc461b34e43..68aba63633cd9 100644
--- a/llvm/utils/unittest/googlemock/include/gmock/gmock.h
+++ b/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 @@ GTEST_API_ void InitGoogleMock(int* argc, wchar_t** argv);
 
 }  // namespace testing
 
-#ifdef __clang__
+#if defined(__clang__) && __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #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 df5f143604bb3..e67f7b42cddce 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
@@ -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 @@ CartesianProductHolder10(const Generator1& g1, const Generator2& g2,
 }  // namespace internal
 }  // namespace testing
 
-#ifdef __clang__
+#if defined(__clang__) &&  __has_warning("-Wdeprecated-copy")
 #pragma clang diagnostic pop
 #endif
 


        


More information about the llvm-commits mailing list