From 10ec11de9c169c5a8ae6d29a09beae6b0d624e91 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Tue, 14 Jun 2022 13:10:59 -0700 Subject: algorithm_test: suppress bogus -Wnonnull warning in GCC 12 Upstream bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105705 PiperOrigin-RevId: 454937873 Change-Id: I44f940caf36d83714af765f01cc43c5143fe21c3 --- absl/algorithm/algorithm_test.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'absl/algorithm/algorithm_test.cc') diff --git a/absl/algorithm/algorithm_test.cc b/absl/algorithm/algorithm_test.cc index 81fccb61..d18df024 100644 --- a/absl/algorithm/algorithm_test.cc +++ b/absl/algorithm/algorithm_test.cc @@ -20,6 +20,7 @@ #include "gmock/gmock.h" #include "gtest/gtest.h" +#include "absl/base/config.h" namespace { @@ -50,7 +51,15 @@ TEST(EqualTest, EmptyRange) { std::vector empty1; std::vector empty2; + // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105705 +#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" +#endif EXPECT_FALSE(absl::equal(v1.begin(), v1.end(), empty1.begin(), empty1.end())); +#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0) +#pragma GCC diagnostic pop +#endif EXPECT_FALSE(absl::equal(empty1.begin(), empty1.end(), v1.begin(), v1.end())); EXPECT_TRUE( absl::equal(empty1.begin(), empty1.end(), empty2.begin(), empty2.end())); -- cgit v1.2.3