From 7aeba12675718bb5f77530927fccee076a0c1550 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Wed, 16 Sep 2026 19:06:44 +0200 Subject: [PATCH] avoided more bogus uninitialized warnings in GCC 16 (#103) --- .../multi_index/detail/ord_index_impl.hpp | 18 ++++++++++-------- include/boost/multi_index/sequenced_index.hpp | 10 ++++++---- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index 82b460e9..abd35623 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -719,7 +719,7 @@ class ordered_index_impl:protected SuperMeta::type #endif { - empty_initialize(); + empty_initialize(h); } ordered_index_impl( @@ -754,7 +754,7 @@ class ordered_index_impl:protected SuperMeta::type #endif { - empty_initialize(); + empty_initialize(h); } ~ordered_index_impl() @@ -1129,14 +1129,16 @@ class ordered_index_impl:protected SuperMeta::type {return index_node_type::from_impl(header()->right());} private: - void empty_initialize() + void empty_initialize(){empty_initialize(header());} + + static void empty_initialize(index_node_type* h) { - header()->color()=red; - /* used to distinguish header() from root, in iterator.operator++ */ + h->color()=red; + /* used to distinguish header from root, in iterator.operator++ */ - header()->parent()=node_impl_pointer(0); - header()->left()=header()->impl(); - header()->right()=header()->impl(); + h->parent()=node_impl_pointer(0); + h->left()=h->impl(); + h->right()=h->impl(); } struct link_info diff --git a/include/boost/multi_index/sequenced_index.hpp b/include/boost/multi_index/sequenced_index.hpp index 4de4fbc3..75307be2 100644 --- a/include/boost/multi_index/sequenced_index.hpp +++ b/include/boost/multi_index/sequenced_index.hpp @@ -665,7 +665,7 @@ class sequenced_index:protected SuperMeta::type #endif { - empty_initialize(); + empty_initialize(h); } sequenced_index( @@ -692,7 +692,7 @@ class sequenced_index:protected SuperMeta::type #endif { - empty_initialize(); + empty_initialize(h); } ~sequenced_index() @@ -896,9 +896,11 @@ class sequenced_index:protected SuperMeta::type private: index_node_type* header()const{return this->final_header();} - void empty_initialize() + void empty_initialize(){empty_initialize(header());} + + static void empty_initialize(index_node_type* h) { - header()->prior()=header()->next()=header()->impl(); + h->prior()=h->next()=h->impl(); } void link(index_node_type* x)