avoided bogus unitialized warnings in GCC 16.1, plus additional warning silencing (#97)

* added gcc-15, gcc-16
* explicitly constructed bfm_header everywhere
* reverted, silenced uninitialized warning
* moved silencing pragma inside header body
* made silencing pragma enclose entire multi_index_container definition
* abandoned pragma, deinlined header()
* tried an even more convoluted workaround
* type-erased member in header_holder
* s/static_cast/reinterpret_cast
* reverted, passed allocator and header explicitly in construction
* used passed header in construction rather than header()
* investigated if hit by https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321
* documented GCC 16.1 flag
* avoided VS warning
This commit is contained in:
joaquintides
2026-06-01 19:15:24 +02:00
committed by GitHub
parent 0d48b7d14b
commit 1f61ddc1ec
10 changed files with 118 additions and 66 deletions
+12
View File
@@ -79,6 +79,18 @@ jobs:
os: ubuntu-24.04
install: g++-14-multilib
address-model: 32,64
- toolset: gcc-15
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:26.04
os: ubuntu-latest
install: g++-15-multilib
address-model: 32,64
- toolset: gcc-16
cxxstd: "11,14,17,20,23,2c"
container: ubuntu:26.04
os: ubuntu-latest
install: g++-16-multilib
address-model: 32,64
- toolset: clang
compiler: clang++-3.9
cxxstd: "11,14"
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -85,10 +85,16 @@ private:
typedef allocator_size_type_t<Allocator> size_type;
protected:
explicit index_base(const ctor_args_list&,const Allocator&){}
explicit index_base(
const ctor_args_list&,const Allocator&,index_node_type*){}
index_base(
const index_base<Value,IndexSpecifierList,Allocator>&,
const Allocator&,index_node_type*){}
index_base(
const index_base<Value,IndexSpecifierList,Allocator>&,
const Allocator&,index_node_type*,
do_not_copy_elements_tag)
{}
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -707,8 +707,10 @@ public:
}
protected:
ordered_index_impl(const ctor_args_list& args_list,const allocator_type& al):
super(args_list.get_tail(),al),
ordered_index_impl(
const ctor_args_list& args_list,
const allocator_type& al,index_node_type* h):
super(args_list.get_tail(),al,h),
key(tuples::get<0>(args_list.get_head())),
comp_(tuples::get<1>(args_list.get_head()))
@@ -722,8 +724,9 @@ protected:
ordered_index_impl(
const ordered_index_impl<
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x):
super(x),
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x,
const allocator_type& al,index_node_type* h):
super(x,al,h),
key(x.key),
comp_(x.comp_)
@@ -740,8 +743,9 @@ protected:
ordered_index_impl(
const ordered_index_impl<
KeyFromValue,Compare,SuperMeta,TagList,Category,AugmentPolicy>& x,
const allocator_type& al,index_node_type* h,
do_not_copy_elements_tag):
super(x,do_not_copy_elements_tag()),
super(x,al,h,do_not_copy_elements_tag()),
key(x.key),
comp_(x.comp_)
@@ -1512,6 +1516,10 @@ class ordered_index:
SuperMeta,TagList,Category,AugmentPolicy
>
>::type super;
protected:
typedef typename super::index_node_type index_node_type;
public:
typedef typename super::ctor_args_list ctor_args_list;
typedef typename super::allocator_type allocator_type;
@@ -1537,13 +1545,18 @@ public:
protected:
ordered_index(
const ctor_args_list& args_list,const allocator_type& al):
super(args_list,al){}
const ctor_args_list& args_list,
const allocator_type& al,index_node_type* h):
super(args_list,al,h){}
ordered_index(const ordered_index& x):super(x){}
ordered_index(
const ordered_index& x,const allocator_type& al,index_node_type* h):
super(x,al,h){}
ordered_index(const ordered_index& x,do_not_copy_elements_tag):
super(x,do_not_copy_elements_tag()){}
ordered_index(
const ordered_index& x,const allocator_type& al,index_node_type* h,
do_not_copy_elements_tag):
super(x,al,h,do_not_copy_elements_tag()){}
};
#if defined(BOOST_MSVC)
+12 -8
View File
@@ -735,12 +735,14 @@ public:
}
protected:
hashed_index(const ctor_args_list& args_list,const allocator_type& al):
super(args_list.get_tail(),al),
hashed_index(
const ctor_args_list& args_list,
const allocator_type& al,index_node_type* h):
super(args_list.get_tail(),al,h),
key(tuples::get<1>(args_list.get_head())),
hash_(tuples::get<2>(args_list.get_head())),
eq_(tuples::get<3>(args_list.get_head())),
buckets(al,header()->impl(),tuples::get<0>(args_list.get_head())),
buckets(al,h->impl(),tuples::get<0>(args_list.get_head())),
mlf(1.0f)
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
@@ -752,12 +754,13 @@ protected:
}
hashed_index(
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x):
super(x),
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
const allocator_type& al,index_node_type* h):
super(x,al,h),
key(x.key),
hash_(x.hash_),
eq_(x.eq_),
buckets(x.get_allocator(),header()->impl(),x.buckets.size()),
buckets(al,h->impl(),x.buckets.size()),
mlf(x.mlf),
max_load(x.max_load)
@@ -773,12 +776,13 @@ protected:
hashed_index(
const hashed_index<KeyFromValue,Hash,Pred,SuperMeta,TagList,Category>& x,
const allocator_type& al,index_node_type* h,
do_not_copy_elements_tag):
super(x,do_not_copy_elements_tag()),
super(x,al,h,do_not_copy_elements_tag()),
key(x.key),
hash_(x.hash_),
eq_(x.eq_),
buckets(x.get_allocator(),header()->impl(),0),
buckets(al,h->impl(),0),
mlf(1.0f)
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -741,9 +741,10 @@ public:
protected:
random_access_index(
const ctor_args_list& args_list,const allocator_type& al):
super(args_list.get_tail(),al),
ptrs(al,header()->impl(),0)
const ctor_args_list& args_list,
const allocator_type& al,index_node_type* h):
super(args_list.get_tail(),al,h),
ptrs(al,h->impl(),0)
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
,safe(*this)
@@ -752,9 +753,11 @@ protected:
{
}
random_access_index(const random_access_index<SuperMeta,TagList>& x):
super(x),
ptrs(x.get_allocator(),header()->impl(),x.size())
random_access_index(
const random_access_index<SuperMeta,TagList>& x,
const allocator_type& al,index_node_type* h):
super(x,al,h),
ptrs(al,h->impl(),x.size())
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
,safe(*this)
@@ -766,9 +769,11 @@ protected:
}
random_access_index(
const random_access_index<SuperMeta,TagList>& x,do_not_copy_elements_tag):
super(x,do_not_copy_elements_tag()),
ptrs(x.get_allocator(),header()->impl(),0)
const random_access_index<SuperMeta,TagList>& x,
const allocator_type& al,index_node_type* h,
do_not_copy_elements_tag):
super(x,al,h,do_not_copy_elements_tag()),
ptrs(al,h->impl(),0)
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
,safe(*this)
+12 -7
View File
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -165,14 +165,19 @@ public:
}
protected:
ranked_index(const ranked_index& x):super(x){};
ranked_index(const ranked_index& x,do_not_copy_elements_tag):
super(x,do_not_copy_elements_tag()){};
ranked_index(
const ranked_index& x,const allocator_type& al,index_node_type* h):
super(x,al,h){};
ranked_index(
const ctor_args_list& args_list,const allocator_type& al):
super(args_list,al){}
const ranked_index& x,const allocator_type& al,index_node_type* h,
do_not_copy_elements_tag):
super(x,al,h,do_not_copy_elements_tag()){};
ranked_index(
const ctor_args_list& args_list,
const allocator_type& al,index_node_type* h):
super(args_list,al,h){}
private:
template<typename LowerBounder,typename UpperBounder>
+13 -7
View File
@@ -1,4 +1,4 @@
/* Copyright 2003-2025 Joaquin M Lopez Munoz.
/* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -655,8 +655,10 @@ public:
}
protected:
sequenced_index(const ctor_args_list& args_list,const allocator_type& al):
super(args_list.get_tail(),al)
sequenced_index(
const ctor_args_list& args_list,
const allocator_type& al,index_node_type* h):
super(args_list.get_tail(),al,h)
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
,safe(*this)
@@ -666,8 +668,10 @@ protected:
empty_initialize();
}
sequenced_index(const sequenced_index<SuperMeta,TagList>& x):
super(x)
sequenced_index(
const sequenced_index<SuperMeta,TagList>& x,
const allocator_type& al,index_node_type* h):
super(x,al,h)
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
,safe(*this)
@@ -678,8 +682,10 @@ protected:
}
sequenced_index(
const sequenced_index<SuperMeta,TagList>& x,do_not_copy_elements_tag):
super(x,do_not_copy_elements_tag())
const sequenced_index<SuperMeta,TagList>& x,
const allocator_type& al,index_node_type* h,
do_not_copy_elements_tag):
super(x,al,h,do_not_copy_elements_tag())
#if defined(BOOST_MULTI_INDEX_ENABLE_SAFE_MODE)
,safe(*this)
+18 -18
View File
@@ -1,6 +1,6 @@
/* Multiply indexed container.
*
* Copyright 2003-2025 Joaquin M Lopez Munoz.
* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -156,7 +156,7 @@ public:
multi_index_container():
bfm_allocator(allocator_type()),
super(ctor_args_list(),bfm_allocator::member),
super(ctor_args_list(),bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -166,7 +166,7 @@ public:
const ctor_args_list& args_list,
const allocator_type& al=allocator_type()):
bfm_allocator(al),
super(args_list,bfm_allocator::member),
super(args_list,bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -174,7 +174,7 @@ public:
explicit multi_index_container(const allocator_type& al):
bfm_allocator(al),
super(ctor_args_list(),bfm_allocator::member),
super(ctor_args_list(),bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -186,7 +186,7 @@ public:
const ctor_args_list& args_list=ctor_args_list(),
const allocator_type& al=allocator_type()):
bfm_allocator(al),
super(args_list,bfm_allocator::member),
super(args_list,bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -210,7 +210,7 @@ public:
const ctor_args_list& args_list=ctor_args_list(),
const allocator_type& al=allocator_type()):
bfm_allocator(al),
super(args_list,bfm_allocator::member),
super(args_list,bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -236,8 +236,7 @@ public:
bfm_allocator(
allocator_select_on_container_copy_construction(
x.bfm_allocator::member)),
bfm_header(),
super(x),
super(x,bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
copy_construct_from(x);
@@ -245,8 +244,9 @@ public:
multi_index_container(multi_index_container&& x):
bfm_allocator(std::move(x.bfm_allocator::member)),
bfm_header(),
super(x,detail::do_not_copy_elements_tag()),
super(
x,bfm_allocator::member,&*bfm_header::member,
detail::do_not_copy_elements_tag()),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -258,8 +258,7 @@ public:
const multi_index_container<Value,IndexSpecifierList,Allocator>& x,
const allocator_type& al):
bfm_allocator(al),
bfm_header(),
super(x),
super(x,bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
copy_construct_from(x);
@@ -268,8 +267,9 @@ public:
multi_index_container(
multi_index_container&& x,const allocator_type& al):
bfm_allocator(al),
bfm_header(),
super(x,detail::do_not_copy_elements_tag()),
super(
x,bfm_allocator::member,&*bfm_header::member,
detail::do_not_copy_elements_tag()),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
@@ -492,8 +492,7 @@ protected:
const allocator_type& al,
detail::unequal_alloc_move_ctor_tag):
bfm_allocator(al),
bfm_header(),
super(x),
super(x,bfm_allocator::member,&*bfm_header::member),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT_OF(x);
@@ -524,8 +523,9 @@ protected:
const multi_index_container<Value,IndexSpecifierList,Allocator>& x,
detail::do_not_copy_elements_tag):
bfm_allocator(x.bfm_allocator::member),
bfm_header(),
super(x,detail::do_not_copy_elements_tag()),
super(
x,bfm_allocator::member,&*bfm_header::member,
detail::do_not_copy_elements_tag()),
node_count(0)
{
BOOST_MULTI_INDEX_CHECK_INVARIANT;
+2 -1
View File
@@ -1,6 +1,6 @@
# Boost.MultiIndex tests Jamfile
#
# Copyright 2003-2025 Joaquín M López Muñoz.
# Copyright 2003-2026 Joaquín M López Muñoz.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
@@ -37,6 +37,7 @@ project
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
<toolset>msvc:<define>_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
<toolset>msvc:<cxxflags>/wd4494
<toolset>gcc-16:<cxxflags>-fno-thread-jumps # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119321
;
obj boost_multi_index_key_supported : check_bmi_key_supported.cpp ;
+2 -2
View File
@@ -1,6 +1,6 @@
/* Boost.MultiIndex test for allocator awareness.
*
* Copyright 2003-2025 Joaquin M Lopez Munoz.
* Copyright 2003-2026 Joaquin M Lopez Munoz.
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
@@ -115,7 +115,7 @@ void test_allocator_awareness_for()
BOOST_TEST(element_transfer==(&*c3.begin()==pfirst));
BOOST_TEST(!element_transfer==(c3.begin()->move_cted));
}
if(Propagate||AlwaysEqual){
BOOST_IF_CONSTEXPR(Propagate||AlwaysEqual){
container c2(c);
const move_tracker* pfirst=&*c2.begin();
container c3(root2);