From 18a86594b635978ea54127e560e14e3ace3f441c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ion=20Gazta=C3=B1aga?= Date: Mon, 30 Sep 2024 15:59:00 +0200 Subject: [PATCH] Fix some Wshadow warnings for old GCCs --- include/boost/container/allocator.hpp | 4 ++-- include/boost/container/devector.hpp | 26 +++++++++++------------ include/boost/container/small_vector.hpp | 8 +++---- include/boost/container/stable_vector.hpp | 6 +++--- include/boost/container/vector.hpp | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/boost/container/allocator.hpp b/include/boost/container/allocator.hpp index 68a158c..3d82f71 100644 --- a/include/boost/container/allocator.hpp +++ b/include/boost/container/allocator.hpp @@ -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(&chain)); } diff --git a/include/boost/container/devector.hpp b/include/boost/container/devector.hpp index 5d9fb7b..59581a3 100644 --- a/include/boost/container/devector.hpp +++ b/include/boost/container/devector.hpp @@ -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; } } @@ -2312,20 +2312,20 @@ class devector return static_cast(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)); } } @@ -2427,10 +2427,10 @@ class devector } template - 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(); } @@ -2809,10 +2809,10 @@ class devector template - 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(); } diff --git a/include/boost/container/small_vector.hpp b/include/boost/container/small_vector.hpp index 5882326..3f260ac 100644 --- a/include/boost/container/small_vector.hpp +++ b/include/boost/container/small_vector.hpp @@ -389,13 +389,13 @@ class small_vector_base {} template - 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(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(a)) {} template - 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(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(a), x) {} inline explicit small_vector_base(maybe_initial_capacity_t, size_type initial_capacity, size_type initial_size) diff --git a/include/boost/container/stable_vector.hpp b/include/boost/container/stable_vector.hpp index aa315b0..f8952c8 100644 --- a/include/boost/container/stable_vector.hpp +++ b/include/boost/container/stable_vector.hpp @@ -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; } diff --git a/include/boost/container/vector.hpp b/include/boost/container/vector.hpp index b8542e5..57020d1 100644 --- a/include/boost/container/vector.hpp +++ b/include/boost/container/vector.hpp @@ -2399,9 +2399,9 @@ private: } //Function for optimizations, not for users - T *unused_storage(size_type &size) + T *unused_storage(size_type &sz) { - size = static_cast(this->capacity() - this->size()); + sz = static_cast(this->capacity() - this->size()); return this->priv_raw_end(); }