mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-29 19:07:15 +02:00
Clean up warnings. Fixes trac #9377.
This commit is contained in:
@ -537,9 +537,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
node_pointer first_node = static_cast<node_pointer>(prev->next_);
|
||||
link_pointer end = first_node->group_prev_->next_;
|
||||
|
||||
std::size_t count = this->delete_nodes(prev, end);
|
||||
std::size_t deleted_count = this->delete_nodes(prev, end);
|
||||
this->fix_bucket(bucket_index, prev);
|
||||
return count;
|
||||
return deleted_count;
|
||||
}
|
||||
|
||||
iterator erase(c_iterator r)
|
||||
@ -558,21 +558,21 @@ namespace boost { namespace unordered { namespace detail {
|
||||
return iterator(r2.node_);
|
||||
}
|
||||
|
||||
link_pointer erase_nodes(node_pointer begin, node_pointer end)
|
||||
link_pointer erase_nodes(node_pointer i, node_pointer j)
|
||||
{
|
||||
std::size_t bucket_index = this->hash_to_bucket(begin->hash_);
|
||||
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
|
||||
|
||||
// Split the groups containing 'begin' and 'end'.
|
||||
// And get the pointer to the node before begin while
|
||||
// Split the groups containing 'i' and 'j'.
|
||||
// And get the pointer to the node before i while
|
||||
// we're at it.
|
||||
link_pointer prev = split_groups(begin, end);
|
||||
link_pointer prev = split_groups(i, j);
|
||||
|
||||
// If we don't have a 'prev' it means that begin is at the
|
||||
// If we don't have a 'prev' it means that i is at the
|
||||
// beginning of a block, so search through the blocks in the
|
||||
// same bucket.
|
||||
if (!prev) {
|
||||
prev = this->get_previous_start(bucket_index);
|
||||
while (prev->next_ != begin)
|
||||
while (prev->next_ != i)
|
||||
prev = static_cast<node_pointer>(prev->next_)->group_prev_;
|
||||
}
|
||||
|
||||
@ -582,24 +582,24 @@ namespace boost { namespace unordered { namespace detail {
|
||||
static_cast<node_pointer>(prev->next_)->group_prev_->next_;
|
||||
this->delete_nodes(prev, group_end);
|
||||
bucket_index = this->fix_bucket(bucket_index, prev);
|
||||
} while(prev->next_ != end);
|
||||
} while(prev->next_ != j);
|
||||
|
||||
return prev;
|
||||
}
|
||||
|
||||
static link_pointer split_groups(node_pointer begin, node_pointer end)
|
||||
static link_pointer split_groups(node_pointer i, node_pointer j)
|
||||
{
|
||||
node_pointer prev = begin->group_prev_;
|
||||
if (prev->next_ != begin) prev = node_pointer();
|
||||
node_pointer prev = i->group_prev_;
|
||||
if (prev->next_ != i) prev = node_pointer();
|
||||
|
||||
if (end) {
|
||||
node_pointer first = end;
|
||||
while (first != begin && first->group_prev_->next_ == first) {
|
||||
if (j) {
|
||||
node_pointer first = j;
|
||||
while (first != i && first->group_prev_->next_ == first) {
|
||||
first = first->group_prev_;
|
||||
}
|
||||
|
||||
boost::swap(first->group_prev_, end->group_prev_);
|
||||
if (first == begin) return prev;
|
||||
boost::swap(first->group_prev_, j->group_prev_);
|
||||
if (first == i) return prev;
|
||||
}
|
||||
|
||||
if (prev) {
|
||||
@ -607,7 +607,7 @@ namespace boost { namespace unordered { namespace detail {
|
||||
while (first->group_prev_->next_ == first) {
|
||||
first = first->group_prev_;
|
||||
}
|
||||
boost::swap(first->group_prev_, begin->group_prev_);
|
||||
boost::swap(first->group_prev_, i->group_prev_);
|
||||
}
|
||||
|
||||
return prev;
|
||||
|
@ -262,9 +262,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
return prev ? iterator(prev->next_) : iterator();
|
||||
}
|
||||
|
||||
std::size_t hash_to_bucket(std::size_t hash) const
|
||||
std::size_t hash_to_bucket(std::size_t hash_value) const
|
||||
{
|
||||
return policy::to_bucket(bucket_count_, hash);
|
||||
return policy::to_bucket(bucket_count_, hash_value);
|
||||
}
|
||||
|
||||
float load_factor() const
|
||||
@ -400,8 +400,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
{
|
||||
if (x.size_) {
|
||||
create_buckets(bucket_count_);
|
||||
copy_nodes<node_allocator> copy(node_alloc());
|
||||
table_impl::fill_buckets(x.begin(), *this, copy);
|
||||
copy_nodes<node_allocator> node_creator(node_alloc());
|
||||
table_impl::fill_buckets(x.begin(), *this, node_creator);
|
||||
}
|
||||
}
|
||||
|
||||
@ -414,9 +414,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// TODO: Could pick new bucket size?
|
||||
create_buckets(bucket_count_);
|
||||
|
||||
move_nodes<node_allocator> move(node_alloc());
|
||||
move_nodes<node_allocator> node_creator(node_alloc());
|
||||
node_holder<node_allocator> nodes(x);
|
||||
table_impl::fill_buckets(nodes.begin(), *this, move);
|
||||
table_impl::fill_buckets(nodes.begin(), *this, node_creator);
|
||||
}
|
||||
}
|
||||
|
||||
@ -660,8 +660,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// assign_nodes takes ownership of the container's elements,
|
||||
// assigning to them if possible, and deleting any that are
|
||||
// left over.
|
||||
assign_nodes<table> assign(*this);
|
||||
table_impl::fill_buckets(x.begin(), *this, assign);
|
||||
assign_nodes<table> node_creator(*this);
|
||||
table_impl::fill_buckets(x.begin(), *this, node_creator);
|
||||
}
|
||||
|
||||
void assign(table const& x, true_type)
|
||||
@ -687,8 +687,8 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// Finally copy the elements.
|
||||
if (x.size_) {
|
||||
create_buckets(bucket_count_);
|
||||
copy_nodes<node_allocator> copy(node_alloc());
|
||||
table_impl::fill_buckets(x.begin(), *this, copy);
|
||||
copy_nodes<node_allocator> node_creator(node_alloc());
|
||||
table_impl::fill_buckets(x.begin(), *this, node_creator);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -735,9 +735,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
// move_assign_nodes takes ownership of the container's
|
||||
// elements, assigning to them if possible, and deleting
|
||||
// any that are left over.
|
||||
move_assign_nodes<table> assign(*this);
|
||||
move_assign_nodes<table> node_creator(*this);
|
||||
node_holder<node_allocator> nodes(x);
|
||||
table_impl::fill_buckets(nodes.begin(), *this, assign);
|
||||
table_impl::fill_buckets(nodes.begin(), *this, node_creator);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,9 +530,9 @@ namespace boost { namespace unordered { namespace detail {
|
||||
|
||||
link_pointer end = static_cast<node_pointer>(prev->next_)->next_;
|
||||
|
||||
std::size_t count = this->delete_nodes(prev, end);
|
||||
std::size_t deleted_count = this->delete_nodes(prev, end);
|
||||
this->fix_bucket(bucket_index, prev);
|
||||
return count;
|
||||
return deleted_count;
|
||||
}
|
||||
|
||||
iterator erase(c_iterator r)
|
||||
@ -551,19 +551,19 @@ namespace boost { namespace unordered { namespace detail {
|
||||
return iterator(r2.node_);
|
||||
}
|
||||
|
||||
void erase_nodes(node_pointer begin, node_pointer end)
|
||||
void erase_nodes(node_pointer i, node_pointer j)
|
||||
{
|
||||
std::size_t bucket_index = this->hash_to_bucket(begin->hash_);
|
||||
std::size_t bucket_index = this->hash_to_bucket(i->hash_);
|
||||
|
||||
// Find the node before begin.
|
||||
// Find the node before i.
|
||||
link_pointer prev = this->get_previous_start(bucket_index);
|
||||
while(prev->next_ != begin) prev = prev->next_;
|
||||
while(prev->next_ != i) prev = prev->next_;
|
||||
|
||||
// Delete the nodes.
|
||||
do {
|
||||
this->delete_node(prev);
|
||||
bucket_index = this->fix_bucket(bucket_index, prev);
|
||||
} while (prev->next_ != end);
|
||||
} while (prev->next_ != j);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -105,7 +105,8 @@ namespace test
|
||||
i = 0; i < x1.bucket_count(); ++i)
|
||||
{
|
||||
for (BOOST_DEDUCED_TYPENAME X::const_local_iterator
|
||||
begin = x1.begin(i), end = x1.end(i); begin != end; ++begin)
|
||||
begin2 = x1.begin(i), end2 = x1.end(i);
|
||||
begin2 != end2; ++begin2)
|
||||
{
|
||||
++bucket_size;
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace test
|
||||
int count = type_ == generate_collisions ?
|
||||
1 + (generate(int_ptr) % 5) : 1;
|
||||
|
||||
for(int i = 0; i < count; ++i) {
|
||||
for(int j = 0; j < count; ++j) {
|
||||
x.push_back(value);
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ namespace test
|
||||
int count = type_ == generate_collisions ?
|
||||
1 + (generate(int_ptr) % 5) : 1;
|
||||
|
||||
for(int i = 0; i < count; ++i) {
|
||||
for(int j = 0; j < count; ++j) {
|
||||
x.push_back(std::pair<key_type const, mapped_type>(
|
||||
key, generate(mapped_ptr)));
|
||||
}
|
||||
|
@ -11,8 +11,8 @@ project unordered-test/unordered
|
||||
<toolset>intel:<warnings>on
|
||||
# Would be nice to define -Wundef, but I'm getting warnings from
|
||||
# Boost.Preprocessor on trunk.
|
||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long -Wfloat-equal"
|
||||
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal"
|
||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wno-long-long -Wfloat-equal -Wshadow"
|
||||
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion -Wfloat-equal -Wshadow"
|
||||
#<toolset>gcc:<define>_GLIBCXX_DEBUG
|
||||
#<toolset>darwin:<define>_GLIBCXX_DEBUG
|
||||
;
|
||||
|
@ -117,7 +117,6 @@ struct compatible_predicate
|
||||
template <class X>
|
||||
void find_compatible_keys_test(X*, test::random_generator generator)
|
||||
{
|
||||
typedef BOOST_DEDUCED_TYPENAME X::iterator iterator;
|
||||
typedef BOOST_DEDUCED_TYPENAME test::random_values<X>::iterator
|
||||
value_iterator;
|
||||
test::random_values<X> v(500, generator);
|
||||
|
@ -363,8 +363,6 @@ void equivalent_emplace_tests1(X*, test::random_generator generator)
|
||||
template <class X>
|
||||
void move_emplace_tests(X*, test::random_generator generator)
|
||||
{
|
||||
typedef test::ordered<X> ordered;
|
||||
|
||||
std::cerr<<"emplace(move(value)) tests for containers with unique keys.\n";
|
||||
|
||||
X x;
|
||||
@ -666,8 +664,8 @@ UNORDERED_AUTO_TEST(insert_initializer_list_multimap)
|
||||
|
||||
struct overloaded_constructor
|
||||
{
|
||||
overloaded_constructor(int x1 = 1, int x2 = 2, int x3 = 3, int x4 = 4)
|
||||
: x1(x1), x2(x2), x3(x3), x4(x4) {}
|
||||
overloaded_constructor(int x1_ = 1, int x2_ = 2, int x3_ = 3, int x4_ = 4)
|
||||
: x1(x1_), x2(x2_), x3(x3_), x4(x4_) {}
|
||||
|
||||
int x1, x2, x3, x4;
|
||||
|
||||
|
@ -69,7 +69,7 @@ namespace noexcept_tests
|
||||
BOOST_NOEXCEPT {}
|
||||
|
||||
hash_nothrow_move() { test_throw("Constructor"); }
|
||||
hash_nothrow_move(hash_nothrow_move const& x) { test_throw("Copy"); }
|
||||
hash_nothrow_move(hash_nothrow_move const&) { test_throw("Copy"); }
|
||||
hash_nothrow_move& operator=(hash_nothrow_move const&)
|
||||
{ test_throw("Assign"); return *this; }
|
||||
std::size_t operator()(int x) const
|
||||
@ -85,7 +85,7 @@ namespace noexcept_tests
|
||||
equal_to_nothrow_move(BOOST_RV_REF(equal_to_nothrow_move))
|
||||
BOOST_NOEXCEPT {}
|
||||
equal_to_nothrow_move() { test_throw("Constructor"); }
|
||||
equal_to_nothrow_move(equal_to_nothrow_move const& x)
|
||||
equal_to_nothrow_move(equal_to_nothrow_move const&)
|
||||
{ test_throw("Copy"); }
|
||||
equal_to_nothrow_move& operator=(equal_to_nothrow_move const&)
|
||||
{ test_throw("Assign"); return *this; }
|
||||
|
Reference in New Issue
Block a user