summaryrefslogtreecommitdiff
path: root/absl
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-06-14 13:10:59 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-06-14 13:11:39 -0700
commit10ec11de9c169c5a8ae6d29a09beae6b0d624e91 (patch)
tree4ff600d70430617772146c5e2e1e6e80d21f7e20 /absl
parentcfd9476bffc36ebb14d09d17424c0878626b3bb9 (diff)
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
Diffstat (limited to 'absl')
-rw-r--r--absl/algorithm/BUILD.bazel1
-rw-r--r--absl/algorithm/CMakeLists.txt1
-rw-r--r--absl/algorithm/algorithm_test.cc9
3 files changed, 11 insertions, 0 deletions
diff --git a/absl/algorithm/BUILD.bazel b/absl/algorithm/BUILD.bazel
index afc52639..f6d74714 100644
--- a/absl/algorithm/BUILD.bazel
+++ b/absl/algorithm/BUILD.bazel
@@ -43,6 +43,7 @@ cc_test(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":algorithm",
+ "//absl/base:config",
"@com_google_googletest//:gtest_main",
],
)
diff --git a/absl/algorithm/CMakeLists.txt b/absl/algorithm/CMakeLists.txt
index 609d8589..181b49ca 100644
--- a/absl/algorithm/CMakeLists.txt
+++ b/absl/algorithm/CMakeLists.txt
@@ -35,6 +35,7 @@ absl_cc_test(
${ABSL_TEST_COPTS}
DEPS
absl::algorithm
+ absl::config
GTest::gmock_main
)
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<int> empty1;
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()));
+#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()));