Skip to content

Commit

Permalink
Fix some Wshadow warnings for old GCCs
Browse files Browse the repository at this point in the history
  • Loading branch information
igaztanaga committed Sep 30, 2024
1 parent 4cc14fc commit 18a8659
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions include/boost/container/allocator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,8 +336,8 @@ class allocator
BOOST_CONTAINER_STATIC_ASSERT(( Version > 1 ));
dlmalloc_memchain ch;
void *beg(&*chain.begin()), *last(&*chain.last());
size_t size(chain.size());
BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size);
size_t sz(chain.size());
BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, sz);
dlmalloc_multidealloc(&ch);
//dlmalloc_multidealloc(move_detail::force_ptr<dlmalloc_memchain *>(&chain));
}
Expand Down
26 changes: 13 additions & 13 deletions include/boost/container/devector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2178,19 +2178,19 @@ class devector
#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED

//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);
if(this->empty()){
size = m_.capacity;
sz = m_.capacity;
return storage_addr;
}
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;
}
else{
size = this->front_free_capacity();
sz = this->front_free_capacity();
return storage_addr;
}
}
Expand Down Expand Up @@ -2312,20 +2312,20 @@ class devector
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
++m_.capacity_alloc_count;
#endif // BOOST_CONTAINER_DEVECTOR_ALLOC_STATS
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));
}
}

Expand Down Expand Up @@ -2427,10 +2427,10 @@ class devector
}

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
boost::container::uninitialized_move_alloc(get_allocator_ref(), begin, end, dst);
boost::container::uninitialized_move_alloc(get_allocator_ref(), b, e, dst);
guard.extend();
}

Expand Down Expand Up @@ -2809,10 +2809,10 @@ class devector


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());
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();
}

Expand Down
8 changes: 4 additions & 4 deletions include/boost/container/small_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,13 @@ class small_vector_base
{}

template<class AllocFwd>
inline explicit small_vector_base(initial_capacity_t, size_type capacity, BOOST_FWD_REF(AllocFwd) a)
: base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<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(), initial_capacity, ::boost::forward<AllocFwd>(a))
{}

template<class AllocFwd>
inline explicit small_vector_base(initial_capacity_t, size_type capacity, BOOST_FWD_REF(AllocFwd) a, small_vector_base &x)
: base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward<AllocFwd>(a), 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(), initial_capacity, ::boost::forward<AllocFwd>(a), x)
{}

inline explicit small_vector_base(maybe_initial_capacity_t, size_type initial_capacity, size_type initial_size)
Expand Down
6 changes: 3 additions & 3 deletions include/boost/container/stable_vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2182,11 +2182,11 @@ class stable_vector
, node_ptr_traits::static_cast_from(pool_first_ref)
, node_ptr_traits::static_cast_from(pool_last_ref)
, 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;
while(beg != end){
while(b != e){
++num_pool;
++beg;
++b;
}
return n >= num_pool && num_pool == internal_data.pool_size;
}
Expand Down
4 changes: 2 additions & 2 deletions include/boost/container/vector.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2399,9 +2399,9 @@ class vector
}

//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();
}

Expand Down

0 comments on commit 18a8659

Please sign in to comment.