diff options
author | Abseil Team <absl-team@google.com> | 2023-12-19 11:51:05 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-12-19 11:52:05 -0800 |
commit | 6d17d4bdfc5969984dc9d763789d7886b6319e8f (patch) | |
tree | f018248856f7f0ca4e9ce4f9d3c141aa7ffb16db /absl/container | |
parent | 46223c8620c98be44628037e0a21c56182bf4f64 (diff) |
Add a pragma to disable a maybe-uninitialized warning for GCC12+
PiperOrigin-RevId: 592301543
Change-Id: I97e4df805c7313896228430a50a7f991127f3e30
Diffstat (limited to 'absl/container')
-rw-r--r-- | absl/container/BUILD.bazel | 1 | ||||
-rw-r--r-- | absl/container/CMakeLists.txt | 1 | ||||
-rw-r--r-- | absl/container/internal/inlined_vector.h | 13 |
3 files changed, 14 insertions, 1 deletions
diff --git a/absl/container/BUILD.bazel b/absl/container/BUILD.bazel index feddbb4c..d2910ed8 100644 --- a/absl/container/BUILD.bazel +++ b/absl/container/BUILD.bazel @@ -126,6 +126,7 @@ cc_library( linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ ":compressed_tuple", + "//absl/base:config", "//absl/base:core_headers", "//absl/memory", "//absl/meta:type_traits", diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt index 742383d8..60afdb2b 100644 --- a/absl/container/CMakeLists.txt +++ b/absl/container/CMakeLists.txt @@ -177,6 +177,7 @@ absl_cc_library( ${ABSL_DEFAULT_COPTS} DEPS absl::compressed_tuple + absl::config absl::core_headers absl::memory absl::span diff --git a/absl/container/internal/inlined_vector.h b/absl/container/internal/inlined_vector.h index b2a602db..0eb9c34d 100644 --- a/absl/container/internal/inlined_vector.h +++ b/absl/container/internal/inlined_vector.h @@ -26,6 +26,7 @@ #include <utility> #include "absl/base/attributes.h" +#include "absl/base/config.h" #include "absl/base/macros.h" #include "absl/container/internal/compressed_tuple.h" #include "absl/memory/memory.h" @@ -384,7 +385,17 @@ class Storage { bool GetIsAllocated() const { return GetSizeAndIsAllocated() & 1; } - Pointer<A> GetAllocatedData() { return data_.allocated.allocated_data; } + Pointer<A> GetAllocatedData() { + // GCC 12 has a false-positive -Wmaybe-uninitialized warning here. +#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + return data_.allocated.allocated_data; +#if ABSL_INTERNAL_HAVE_MIN_GNUC_VERSION(12, 0) +#pragma GCC diagnostic pop +#endif + } ConstPointer<A> GetAllocatedData() const { return data_.allocated.allocated_data; |