aboutsummaryrefslogtreecommitdiff
path: root/absl/container/internal/inlined_vector.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2023-12-19 11:51:05 -0800
committerCopybara-Service <copybara-worker@google.com>2023-12-19 11:52:05 -0800
commit6d17d4bdfc5969984dc9d763789d7886b6319e8f (patch)
treef018248856f7f0ca4e9ce4f9d3c141aa7ffb16db /absl/container/internal/inlined_vector.h
parent46223c8620c98be44628037e0a21c56182bf4f64 (diff)
downloadabseil-6d17d4bdfc5969984dc9d763789d7886b6319e8f.tar.gz
abseil-6d17d4bdfc5969984dc9d763789d7886b6319e8f.tar.bz2
abseil-6d17d4bdfc5969984dc9d763789d7886b6319e8f.zip
Add a pragma to disable a maybe-uninitialized warning for GCC12+
PiperOrigin-RevId: 592301543 Change-Id: I97e4df805c7313896228430a50a7f991127f3e30
Diffstat (limited to 'absl/container/internal/inlined_vector.h')
-rw-r--r--absl/container/internal/inlined_vector.h13
1 files changed, 12 insertions, 1 deletions
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;