Fix some Wshadow warnings for old GCCs

This commit is contained in:
Ion Gaztañaga
2024-09-30 15:59:00 +02:00
parent 4cc14fc42c
commit 18a86594b6
5 changed files with 24 additions and 24 deletions

View File

@@ -336,8 +336,8 @@ class allocator
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 )); BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
dlmalloc_memchain ch; dlmalloc_memchain ch;
void *beg(&*chain.begin()), *last(&*chain.last()); void *beg(&*chain.begin()), *last(&*chain.last());
size_t size(chain.size()); size_t sz(chain.size());
BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size); BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, sz);
dlmalloc_multidealloc(&ch); dlmalloc_multidealloc(&ch);
//dlmalloc_multidealloc(move_detail::force_ptr<dlmalloc_memchain *>(&chain)); //dlmalloc_multidealloc(move_detail::force_ptr<dlmalloc_memchain *>(&chain));
} }

View File

@@ -2178,19 +2178,19 @@ class devector
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//Functions for optimizations, not for users //Functions for optimizations, not for users
T *unused_storage(size_type &size) T *unused_storage(size_type &sz)
{ {
T *const storage_addr = boost::movelib::to_raw_pointer(m_.buffer); T *const storage_addr = boost::movelib::to_raw_pointer(m_.buffer);
if(this->empty()){ if(this->empty()){
size = m_.capacity; sz = m_.capacity;
return storage_addr; return storage_addr;
} }
else if(this->back_free_capacity() > this->front_free_capacity()){ else if(this->back_free_capacity() > this->front_free_capacity()){
size = this->back_free_capacity(); sz = this->back_free_capacity();
return storage_addr + m_.back_idx; return storage_addr + m_.back_idx;
} }
else{ else{
size = this->front_free_capacity(); sz = this->front_free_capacity();
return storage_addr; return storage_addr;
} }
} }
@@ -2312,20 +2312,20 @@ class devector
return static_cast<const allocator_type&>(m_); return static_cast<const allocator_type&>(m_);
} }
pointer allocate(size_type capacity) pointer allocate(size_type cap)
{ {
pointer const p = impl::do_allocate(get_allocator_ref(), capacity); pointer const p = impl::do_allocate(get_allocator_ref(), cap);
#ifdef BOOST_CONTAINER_DEVECTOR_ALLOC_STATS #ifdef BOOST_CONTAINER_DEVECTOR_ALLOC_STATS
++m_.capacity_alloc_count; ++m_.capacity_alloc_count;
#endif // BOOST_CONTAINER_DEVECTOR_ALLOC_STATS #endif // BOOST_CONTAINER_DEVECTOR_ALLOC_STATS
return p; return p;
} }
void destroy_elements(pointer begin, pointer end) void destroy_elements(pointer b, pointer e)
{ {
for (; begin != end; ++begin) for (; b != e; ++b)
{ {
allocator_traits_type::destroy(get_allocator_ref(), boost::movelib::to_raw_pointer(begin)); allocator_traits_type::destroy(get_allocator_ref(), boost::movelib::to_raw_pointer(b));
} }
} }
@@ -2427,10 +2427,10 @@ class devector
} }
template <typename Guard> template <typename Guard>
void opt_move_or_copy(pointer begin, pointer end, pointer dst, Guard& guard) void opt_move_or_copy(pointer b, pointer e, pointer dst, Guard& guard)
{ {
// if trivial copy and default allocator, memcpy // if trivial copy and default allocator, memcpy
boost::container::uninitialized_move_alloc(get_allocator_ref(), begin, end, dst); boost::container::uninitialized_move_alloc(get_allocator_ref(), b, e, dst);
guard.extend(); guard.extend();
} }
@@ -2809,10 +2809,10 @@ class devector
template <typename Iterator> template <typename Iterator>
void construct_from_range(Iterator begin, Iterator end) void construct_from_range(Iterator b, Iterator e)
{ {
allocation_guard buffer_guard(m_.buffer, m_.capacity, get_allocator_ref()); allocation_guard buffer_guard(m_.buffer, m_.capacity, get_allocator_ref());
boost::container::uninitialized_copy_alloc(get_allocator_ref(), begin, end, m_.buffer); boost::container::uninitialized_copy_alloc(get_allocator_ref(), b, e, m_.buffer);
buffer_guard.release(); buffer_guard.release();
} }

View File

@@ -389,13 +389,13 @@ class small_vector_base
{} {}
template<class AllocFwd> template<class AllocFwd>
inline explicit small_vector_base(initial_capacity_t, size_type capacity, BOOST_FWD_REF(AllocFwd) a) inline explicit small_vector_base(initial_capacity_t, size_type initial_capacity, BOOST_FWD_REF(AllocFwd) a)
: base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<AllocFwd>(a)) : base_type(initial_capacity_t(), this->internal_storage(), initial_capacity, ::boost::forward<AllocFwd>(a))
{} {}
template<class AllocFwd> template<class AllocFwd>
inline explicit small_vector_base(initial_capacity_t, size_type capacity, BOOST_FWD_REF(AllocFwd) a, small_vector_base &x) inline explicit small_vector_base(initial_capacity_t, size_type initial_capacity, BOOST_FWD_REF(AllocFwd) a, small_vector_base &x)
: base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<AllocFwd>(a), x) : base_type(initial_capacity_t(), this->internal_storage(), initial_capacity, ::boost::forward<AllocFwd>(a), x)
{} {}
inline explicit small_vector_base(maybe_initial_capacity_t, size_type initial_capacity, size_type initial_size) inline explicit small_vector_base(maybe_initial_capacity_t, size_type initial_capacity, size_type initial_size)

View File

@@ -2182,11 +2182,11 @@ class stable_vector
, node_ptr_traits::static_cast_from(pool_first_ref) , node_ptr_traits::static_cast_from(pool_first_ref)
, node_ptr_traits::static_cast_from(pool_last_ref) , node_ptr_traits::static_cast_from(pool_last_ref)
, internal_data.pool_size); , internal_data.pool_size);
typename multiallocation_chain::iterator beg(holder.begin()), end(holder.end()); typename multiallocation_chain::iterator b(holder.begin()), e(holder.end());
size_type num_pool = 0; size_type num_pool = 0;
while(beg != end){ while(b != e){
++num_pool; ++num_pool;
++beg; ++b;
} }
return n >= num_pool && num_pool == internal_data.pool_size; return n >= num_pool && num_pool == internal_data.pool_size;
} }

View File

@@ -2399,9 +2399,9 @@ private:
} }
//Function for optimizations, not for users //Function for optimizations, not for users
T *unused_storage(size_type &size) T *unused_storage(size_type &sz)
{ {
size = static_cast<size_type>(this->capacity() - this->size()); sz = static_cast<size_type>(this->capacity() - this->size());
return this->priv_raw_end(); return this->priv_raw_end();
} }