Commit 10ec11de by Derek Mauro Committed by Copybara-Service

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
parent cfd9476b
...@@ -43,6 +43,7 @@ cc_test( ...@@ -43,6 +43,7 @@ cc_test(
linkopts = ABSL_DEFAULT_LINKOPTS, linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [ deps = [
":algorithm", ":algorithm",
"//absl/base:config",
"@com_google_googletest//:gtest_main", "@com_google_googletest//:gtest_main",
], ],
) )
......
...@@ -35,6 +35,7 @@ absl_cc_test( ...@@ -35,6 +35,7 @@ absl_cc_test(
${ABSL_TEST_COPTS} ${ABSL_TEST_COPTS}
DEPS DEPS
absl::algorithm absl::algorithm
absl::config
GTest::gmock_main GTest::gmock_main
) )
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "absl/base/config.h"
namespace { namespace {
...@@ -50,7 +51,15 @@ TEST(EqualTest, EmptyRange) { ...@@ -50,7 +51,15 @@ TEST(EqualTest, EmptyRange) {
std::vector<int> empty1; std::vector<int> empty1;
std::vector<int> empty2; std::vector<int> 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())); 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_FALSE(absl::equal(empty1.begin(), empty1.end(), v1.begin(), v1.end()));
EXPECT_TRUE( EXPECT_TRUE(
absl::equal(empty1.begin(), empty1.end(), empty2.begin(), empty2.end())); absl::equal(empty1.begin(), empty1.end(), empty2.begin(), empty2.end()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment