Merge pull request #49 from SiggyBar/develop

Fix empty control statement warnings.
This commit is contained in:
Ion Gaztañaga
2020-10-19 13:26:17 +02:00
committed by GitHub
5 changed files with 22 additions and 44 deletions

View File

@@ -1062,8 +1062,7 @@ class bstree_impl
iterator insert_equal(reference value) iterator insert_equal(reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
iterator ret(node_algorithms::insert_equal_upper_bound iterator ret(node_algorithms::insert_equal_upper_bound
(this->header_ptr(), to_insert, this->key_node_comp(this->key_comp())), this->priv_value_traits_ptr()); (this->header_ptr(), to_insert, this->key_node_comp(this->key_comp())), this->priv_value_traits_ptr());
this->sz_traits().increment(); this->sz_traits().increment();
@@ -1087,8 +1086,7 @@ class bstree_impl
iterator insert_equal(const_iterator hint, reference value) iterator insert_equal(const_iterator hint, reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
iterator ret(node_algorithms::insert_equal iterator ret(node_algorithms::insert_equal
(this->header_ptr(), hint.pointed_node(), to_insert, this->key_node_comp(this->key_comp())), this->priv_value_traits_ptr()); (this->header_ptr(), hint.pointed_node(), to_insert, this->key_node_comp(this->key_comp())), this->priv_value_traits_ptr());
this->sz_traits().increment(); this->sz_traits().increment();
@@ -1317,8 +1315,7 @@ class bstree_impl
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) iterator insert_unique_commit(reference value, const insert_commit_data &commit_data)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
#if !(defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) )) #if !(defined(BOOST_DISABLE_ASSERTS) || ( defined(BOOST_ENABLE_ASSERT_DEBUG_HANDLER) && defined(NDEBUG) ))
//Test insertion position is correct //Test insertion position is correct
@@ -1355,8 +1352,7 @@ class bstree_impl
iterator insert_before(const_iterator pos, reference value) iterator insert_before(const_iterator pos, reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
this->sz_traits().increment(); this->sz_traits().increment();
return iterator(node_algorithms::insert_before return iterator(node_algorithms::insert_before
(this->header_ptr(), pos.pointed_node(), to_insert), this->priv_value_traits_ptr()); (this->header_ptr(), pos.pointed_node(), to_insert), this->priv_value_traits_ptr());
@@ -1379,8 +1375,7 @@ class bstree_impl
void push_back(reference value) void push_back(reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
this->sz_traits().increment(); this->sz_traits().increment();
node_algorithms::push_back(this->header_ptr(), to_insert); node_algorithms::push_back(this->header_ptr(), to_insert);
} }
@@ -1402,8 +1397,7 @@ class bstree_impl
void push_front(reference value) void push_front(reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
this->sz_traits().increment(); this->sz_traits().increment();
node_algorithms::push_front(this->header_ptr(), to_insert); node_algorithms::push_front(this->header_ptr(), to_insert);
} }
@@ -1421,8 +1415,7 @@ class bstree_impl
const_iterator ret(i); const_iterator ret(i);
++ret; ++ret;
node_ptr to_erase(i.pointed_node()); node_ptr to_erase(i.pointed_node());
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || !node_algorithms::unique(to_erase));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
node_algorithms::erase(this->header_ptr(), to_erase); node_algorithms::erase(this->header_ptr(), to_erase);
this->sz_traits().decrement(); this->sz_traits().decrement();
if(safemode_or_autounlink) if(safemode_or_autounlink)
@@ -2061,8 +2054,7 @@ class bstree_impl
typedef typename get_node_checker<AlgoType, ValueTraits, nodeptr_comp_t, ExtraChecker>::type node_checker_t; typedef typename get_node_checker<AlgoType, ValueTraits, nodeptr_comp_t, ExtraChecker>::type node_checker_t;
typename node_checker_t::return_type checker_return; typename node_checker_t::return_type checker_return;
node_algorithms::check(this->header_ptr(), node_checker_t(nodeptr_comp, extra_checker), checker_return); node_algorithms::check(this->header_ptr(), node_checker_t(nodeptr_comp, extra_checker), checker_return);
if (constant_time_size) BOOST_INTRUSIVE_INVARIANT_ASSERT(!constant_time_size || this->sz_traits().get_size() == checker_return.node_count);
BOOST_INTRUSIVE_INVARIANT_ASSERT(this->sz_traits().get_size() == checker_return.node_count);
} }
//! <b>Effects</b>: Asserts the integrity of the container. //! <b>Effects</b>: Asserts the integrity of the container.

View File

@@ -83,10 +83,8 @@ struct bstree_node_checker
const return_type& check_return_left, const return_type& check_return_right, const return_type& check_return_left, const return_type& check_return_right,
return_type& check_return) return_type& check_return)
{ {
if (check_return_left.max_key_node_ptr) BOOST_INTRUSIVE_INVARIANT_ASSERT(!check_return_left.max_key_node_ptr || !comp_(p, check_return_left.max_key_node_ptr));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!comp_(p, check_return_left.max_key_node_ptr)); BOOST_INTRUSIVE_INVARIANT_ASSERT(!check_return_right.min_key_node_ptr || !comp_(check_return_right.min_key_node_ptr, p));
if (check_return_right.min_key_node_ptr)
BOOST_INTRUSIVE_INVARIANT_ASSERT(!comp_(check_return_right.min_key_node_ptr, p));
check_return.min_key_node_ptr = node_traits::get_left(p)? check_return_left.min_key_node_ptr : p; check_return.min_key_node_ptr = node_traits::get_left(p)? check_return_left.min_key_node_ptr : p;
check_return.max_key_node_ptr = node_traits::get_right(p)? check_return_right.max_key_node_ptr : p; check_return.max_key_node_ptr = node_traits::get_right(p)? check_return_right.max_key_node_ptr : p;
check_return.node_count = check_return_left.node_count + check_return_right.node_count + 1; check_return.node_count = check_return_left.node_count + check_return_right.node_count + 1;

View File

@@ -447,8 +447,7 @@ class sgtree_impl
iterator insert_equal(reference value) iterator insert_equal(reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)this->max_tree_size_; std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
node_ptr p = node_algorithms::insert_equal_upper_bound node_ptr p = node_algorithms::insert_equal_upper_bound
(this->tree_type::header_ptr(), to_insert, this->key_node_comp(this->key_comp()) (this->tree_type::header_ptr(), to_insert, this->key_node_comp(this->key_comp())
@@ -462,8 +461,7 @@ class sgtree_impl
iterator insert_equal(const_iterator hint, reference value) iterator insert_equal(const_iterator hint, reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)this->max_tree_size_; std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
node_ptr p = node_algorithms::insert_equal node_ptr p = node_algorithms::insert_equal
( this->tree_type::header_ptr(), hint.pointed_node(), to_insert, this->key_node_comp(this->key_comp()) ( this->tree_type::header_ptr(), hint.pointed_node(), to_insert, this->key_node_comp(this->key_comp())
@@ -545,8 +543,7 @@ class sgtree_impl
iterator insert_unique_commit(reference value, const insert_commit_data &commit_data) iterator insert_unique_commit(reference value, const insert_commit_data &commit_data)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)this->max_tree_size_; std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
node_algorithms::insert_unique_commit node_algorithms::insert_unique_commit
( this->tree_type::header_ptr(), to_insert, commit_data ( this->tree_type::header_ptr(), to_insert, commit_data
@@ -575,8 +572,7 @@ class sgtree_impl
iterator insert_before(const_iterator pos, reference value) iterator insert_before(const_iterator pos, reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)this->max_tree_size_; std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
node_ptr p = node_algorithms::insert_before node_ptr p = node_algorithms::insert_before
( this->tree_type::header_ptr(), pos.pointed_node(), to_insert ( this->tree_type::header_ptr(), pos.pointed_node(), to_insert
@@ -590,8 +586,7 @@ class sgtree_impl
void push_back(reference value) void push_back(reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)this->max_tree_size_; std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
node_algorithms::push_back node_algorithms::push_back
( this->tree_type::header_ptr(), to_insert ( this->tree_type::header_ptr(), to_insert
@@ -604,8 +599,7 @@ class sgtree_impl
void push_front(reference value) void push_front(reference value)
{ {
node_ptr to_insert(this->get_value_traits().to_node_ptr(value)); node_ptr to_insert(this->get_value_traits().to_node_ptr(value));
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || node_algorithms::unique(to_insert));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(node_algorithms::unique(to_insert));
std::size_t max_tree_size = (std::size_t)this->max_tree_size_; std::size_t max_tree_size = (std::size_t)this->max_tree_size_;
node_algorithms::push_front node_algorithms::push_front
( this->tree_type::header_ptr(), to_insert ( this->tree_type::header_ptr(), to_insert
@@ -621,8 +615,7 @@ class sgtree_impl
const_iterator ret(i); const_iterator ret(i);
++ret; ++ret;
node_ptr to_erase(i.pointed_node()); node_ptr to_erase(i.pointed_node());
if(safemode_or_autounlink) BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!safemode_or_autounlink || !node_algorithms::unique(to_erase));
BOOST_INTRUSIVE_SAFE_HOOK_DEFAULT_ASSERT(!node_algorithms::unique(to_erase));
std::size_t max_tree_size = this->max_tree_size_; std::size_t max_tree_size = this->max_tree_size_;
node_algorithms::erase node_algorithms::erase
( this->tree_type::header_ptr(), to_erase, (std::size_t)this->size() ( this->tree_type::header_ptr(), to_erase, (std::size_t)this->size()

View File

@@ -1937,8 +1937,7 @@ class slist_impl
BOOST_INTRUSIVE_INVARIANT_ASSERT(node_traits::get_next(header_ptr)); BOOST_INTRUSIVE_INVARIANT_ASSERT(node_traits::get_next(header_ptr));
if (node_traits::get_next(header_ptr) == header_ptr) if (node_traits::get_next(header_ptr) == header_ptr)
{ {
if (constant_time_size) BOOST_INTRUSIVE_INVARIANT_ASSERT(!constant_time_size || this->priv_size_traits().get_size() == 0);
BOOST_INTRUSIVE_INVARIANT_ASSERT(this->priv_size_traits().get_size() == 0);
return; return;
} }
size_t node_count = 0; size_t node_count = 0;
@@ -1956,15 +1955,13 @@ class slist_impl
} }
if ((!linear && next_p == header_ptr) || (linear && !next_p)) if ((!linear && next_p == header_ptr) || (linear && !next_p))
{ {
if (cache_last) BOOST_INTRUSIVE_INVARIANT_ASSERT(!cache_last || get_last_node() == p);
BOOST_INTRUSIVE_INVARIANT_ASSERT(get_last_node() == p);
break; break;
} }
p = next_p; p = next_p;
++node_count; ++node_count;
} }
if (constant_time_size) BOOST_INTRUSIVE_INVARIANT_ASSERT(!constant_time_size || this->priv_size_traits().get_size() == node_count);
BOOST_INTRUSIVE_INVARIANT_ASSERT(this->priv_size_traits().get_size() == node_count);
} }

View File

@@ -53,10 +53,8 @@ struct treap_node_extra_checker
const return_type& check_return_left, const return_type& check_return_right, const return_type& check_return_left, const return_type& check_return_right,
return_type& check_return) return_type& check_return)
{ {
if (node_traits::get_left(p)) BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_traits::get_left(p) || !prio_comp_(node_traits::get_left(p), p));
BOOST_INTRUSIVE_INVARIANT_ASSERT(!prio_comp_(node_traits::get_left(p), p)); BOOST_INTRUSIVE_INVARIANT_ASSERT(!node_traits::get_right(p) || !prio_comp_(node_traits::get_right(p), p));
if (node_traits::get_right(p))
BOOST_INTRUSIVE_INVARIANT_ASSERT(!prio_comp_(node_traits::get_right(p), p));
base_checker_t::operator()(p, check_return_left, check_return_right, check_return); base_checker_t::operator()(p, check_return_left, check_return_right, check_return);
} }