Commit 1ab79481 by Benjamin Kosnik Committed by Benjamin Kosnik

hashtable.h: -Wshadow fixes.

2006-11-21  Benjamin Kosnik  <bkoz@redhat.com>
	
	* include/ext/hashtable.h: -Wshadow fixes.
	* include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/pat_trie_/internal_node.hpp: Same.
	* include/ext/pb_ds/detail/gp_hash_table_map_/
	constructor_destructor_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same.
	* include/ext/pb_ds/detail/ov_tree_map_/
	constructors_destructor_fn_imps.hpp: Same.
	* src/mt_allocator.cc: Same.
	* src/debug.cc: Same.
	* config/locale/gnu/codecvt_members.cc: Same.

From-SVN: r119061
parent 7ddd8380
2006-11-21 Benjamin Kosnik <bkoz@redhat.com> 2006-11-21 Benjamin Kosnik <bkoz@redhat.com>
* include/ext/hashtable.h: -Wshadow fixes.
* include/ext/pb_ds/detail/cc_hash_table_map_/erase_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/cc_hash_table_map_/resize_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/pat_trie_/internal_node.hpp: Same.
* include/ext/pb_ds/detail/gp_hash_table_map_/
constructor_destructor_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/binary_heap_/split_join_fn_imps.hpp: Same.
* include/ext/pb_ds/detail/ov_tree_map_/
constructors_destructor_fn_imps.hpp: Same.
* src/mt_allocator.cc: Same.
* src/debug.cc: Same.
* config/locale/gnu/codecvt_members.cc: Same.
2006-11-21 Benjamin Kosnik <bkoz@redhat.com>
Howard Hinnant <hhinnant@apple.com> Howard Hinnant <hhinnant@apple.com>
* src/iostream-inst.cc: Remove iostream include. * src/iostream-inst.cc: Remove iostream include.
......
// std::codecvt implementation details, GNU version -*- C++ -*- // std::codecvt implementation details, GNU version -*- C++ -*-
// Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. // Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc.
// //
// This file is part of the GNU ISO C++ Library. This library is free // This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the // software; you can redistribute it and/or modify it under the
...@@ -95,14 +95,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std) ...@@ -95,14 +95,14 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
{ {
extern_type __buf[MB_LEN_MAX]; extern_type __buf[MB_LEN_MAX];
__tmp_state = __state; __tmp_state = __state;
const size_t __conv = wcrtomb(__buf, *__from_next, &__tmp_state); const size_t __conv2 = wcrtomb(__buf, *__from_next, &__tmp_state);
if (__conv > static_cast<size_t>(__to_end - __to_next)) if (__conv2 > static_cast<size_t>(__to_end - __to_next))
__ret = partial; __ret = partial;
else else
{ {
memcpy(__to_next, __buf, __conv); memcpy(__to_next, __buf, __conv2);
__state = __tmp_state; __state = __tmp_state;
__to_next += __conv; __to_next += __conv2;
++__from_next; ++__from_next;
} }
} }
......
...@@ -713,7 +713,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -713,7 +713,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__cur1 = __cur1->_M_next) __cur1 = __cur1->_M_next)
{ {
bool _found__cur1 = false; bool _found__cur1 = false;
for (_Node* __cur2 = __ht2._M_buckets[__n]; for (__cur2 = __ht2._M_buckets[__n];
__cur2; __cur2 = __cur2->_M_next) __cur2; __cur2 = __cur2->_M_next)
{ {
if (__cur1->_M_val == __cur2->_M_val) if (__cur1->_M_val == __cur2->_M_val)
......
...@@ -131,8 +131,8 @@ join(PB_DS_CLASS_C_DEC& other) ...@@ -131,8 +131,8 @@ join(PB_DS_CLASS_C_DEC& other)
_GLIBCXX_DEBUG_ONLY(assert_valid();) _GLIBCXX_DEBUG_ONLY(assert_valid();)
_GLIBCXX_DEBUG_ONLY(other.assert_valid();) _GLIBCXX_DEBUG_ONLY(other.assert_valid();)
const size_type size = m_size + other.m_size; const size_type len = m_size + other.m_size;
const size_type actual_size = resize_policy::get_new_size_for_arbitrary(size); const size_type actual_size = resize_policy::get_new_size_for_arbitrary(len);
entry_pointer a_entries = NULL; entry_pointer a_entries = NULL;
entry_pointer a_other_entries = NULL; entry_pointer a_other_entries = NULL;
...@@ -158,7 +158,7 @@ join(PB_DS_CLASS_C_DEC& other) ...@@ -158,7 +158,7 @@ join(PB_DS_CLASS_C_DEC& other)
s_entry_allocator.deallocate(m_a_entries, m_actual_size); s_entry_allocator.deallocate(m_a_entries, m_actual_size);
m_a_entries = a_entries; m_a_entries = a_entries;
m_size = size; m_size = len;
m_actual_size = actual_size; m_actual_size = actual_size;
resize_policy::notify_arbitrary(actual_size); resize_policy::notify_arbitrary(actual_size);
......
...@@ -64,7 +64,6 @@ inline typename PB_DS_CLASS_C_DEC::size_type ...@@ -64,7 +64,6 @@ inline typename PB_DS_CLASS_C_DEC::size_type
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
erase_if(Pred pred) erase_if(Pred pred)
{ {
typedef typename PB_DS_TYPES_TRAITS_C_DEC::const_reference const_reference;
size_type num_ersd = 0; size_type num_ersd = 0;
for (size_type pos = 0; pos < m_num_e; ++pos) for (size_type pos = 0; pos < m_num_e; ++pos)
{ {
......
...@@ -58,8 +58,8 @@ do_resize_if_needed() ...@@ -58,8 +58,8 @@ do_resize_if_needed()
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
void void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
do_resize(size_type size) do_resize(size_type len)
{ resize_imp(resize_base::get_nearest_larger_size(size)); } { resize_imp(resize_base::get_nearest_larger_size(len)); }
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
inline void inline void
......
...@@ -110,10 +110,10 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, ...@@ -110,10 +110,10 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& probe_fn) const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober)
: hash_eq_fn_base(r_eq_fn), : hash_eq_fn_base(r_eq_fn),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, comb_hash_fn, probe_fn), r_hash_fn, comb_hash_fn, prober),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e)) m_entries(s_entry_allocator.allocate(m_num_e))
{ {
...@@ -124,11 +124,11 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, ...@@ -124,11 +124,11 @@ PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn, PB_DS_CLASS_NAME(const Hash_Fn& r_hash_fn, const Eq_Fn& r_eq_fn,
const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& probe_fn, const Comb_Probe_Fn& comb_hash_fn, const Probe_Fn& prober,
const Resize_Policy& r_resize_policy) const Resize_Policy& r_resize_policy)
: hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy), : hash_eq_fn_base(r_eq_fn), resize_base(r_resize_policy),
ranged_probe_fn_base(resize_base::get_nearest_larger_size(1), ranged_probe_fn_base(resize_base::get_nearest_larger_size(1),
r_hash_fn, comb_hash_fn, probe_fn), r_hash_fn, comb_hash_fn, prober),
m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0), m_num_e(resize_base::get_nearest_larger_size(1)), m_num_used_e(0),
m_entries(s_entry_allocator.allocate(m_num_e)) m_entries(s_entry_allocator.allocate(m_num_e))
{ {
...@@ -205,9 +205,9 @@ deallocate_all() ...@@ -205,9 +205,9 @@ deallocate_all()
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
void void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
erase_all_valid_entries(entry_array a_entries_resized, size_type size) erase_all_valid_entries(entry_array a_entries_resized, size_type len)
{ {
for (size_type pos = 0; pos < size; ++pos) for (size_type pos = 0; pos < len; ++pos)
{ {
entry_pointer p_e = &a_entries_resized[pos]; entry_pointer p_e = &a_entries_resized[pos];
if (p_e->m_stat == valid_entry_status) if (p_e->m_stat == valid_entry_status)
......
...@@ -137,16 +137,16 @@ void ...@@ -137,16 +137,16 @@ void
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
copy_from_ordered_range(It first_it, It last_it) copy_from_ordered_range(It first_it, It last_it)
{ {
const size_type size = std::distance(first_it, last_it); const size_type len = std::distance(first_it, last_it);
if (size == 0) if (len == 0)
return; return;
value_vector a_values = s_value_alloc.allocate(size); value_vector a_values = s_value_alloc.allocate(len);
iterator target_it = a_values; iterator target_it = a_values;
It source_it = first_it; It source_it = first_it;
It source_end_it = last_it; It source_end_it = last_it;
cond_dtor<size_type> cd(a_values, target_it, size); cond_dtor<size_type> cd(a_values, target_it, len);
while (source_it != source_end_it) while (source_it != source_end_it)
{ {
new (const_cast<void* >(static_cast<const void* >(target_it))) new (const_cast<void* >(static_cast<const void* >(target_it)))
...@@ -155,10 +155,10 @@ copy_from_ordered_range(It first_it, It last_it) ...@@ -155,10 +155,10 @@ copy_from_ordered_range(It first_it, It last_it)
++target_it; ++target_it;
} }
reallocate_metadata((node_update* )this, size); reallocate_metadata((node_update* )this, len);
cd.set_no_action(); cd.set_no_action();
m_a_values = a_values; m_a_values = a_values;
m_size = size; m_size = len;
m_end_it = m_a_values + m_size; m_end_it = m_a_values + m_size;
update(PB_DS_node_begin_imp(), (node_update* )this); update(PB_DS_node_begin_imp(), (node_update* )this);
...@@ -181,16 +181,16 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it, ...@@ -181,16 +181,16 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it,
It other_last_it) It other_last_it)
{ {
clear(); clear();
const size_type size = std::distance(first_it, last_it) const size_type len = std::distance(first_it, last_it)
+ std::distance(other_first_it, other_last_it); + std::distance(other_first_it, other_last_it);
value_vector a_values = s_value_alloc.allocate(size); value_vector a_values = s_value_alloc.allocate(len);
iterator target_it = a_values; iterator target_it = a_values;
It source_it = first_it; It source_it = first_it;
It source_end_it = last_it; It source_end_it = last_it;
cond_dtor<size_type> cd(a_values, target_it, size); cond_dtor<size_type> cd(a_values, target_it, len);
while (source_it != source_end_it) while (source_it != source_end_it)
{ {
new (const_cast<void* >(static_cast<const void* >(target_it))) new (const_cast<void* >(static_cast<const void* >(target_it)))
...@@ -208,10 +208,10 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it, ...@@ -208,10 +208,10 @@ copy_from_ordered_range(It first_it, It last_it, It other_first_it,
++target_it; ++target_it;
} }
reallocate_metadata((node_update* )this, size); reallocate_metadata((node_update* )this, len);
cd.set_no_action(); cd.set_no_action();
m_a_values = a_values; m_a_values = a_values;
m_size = size; m_size = len;
m_end_it = m_a_values + m_size; m_end_it = m_a_values + m_size;
update(PB_DS_node_begin_imp(), (node_update* )this); update(PB_DS_node_begin_imp(), (node_update* )this);
......
...@@ -243,9 +243,9 @@ namespace pb_ds ...@@ -243,9 +243,9 @@ namespace pb_ds
PB_DS_CLASS_T_DEC PB_DS_CLASS_T_DEC
PB_DS_CLASS_C_DEC:: PB_DS_CLASS_C_DEC::
pat_trie_internal_node(size_type e_ind, const const_e_iterator pref_b_it) : pat_trie_internal_node(size_type len, const const_e_iterator it) :
PB_DS_BASE_C_DEC(pat_trie_internal_node_type), PB_DS_BASE_C_DEC(pat_trie_internal_node_type),
m_e_ind(e_ind), m_pref_b_it(pref_b_it), m_pref_e_it(pref_b_it) m_e_ind(len), m_pref_b_it(it), m_pref_e_it(it)
{ {
std::advance(m_pref_e_it, m_e_ind); std::advance(m_pref_e_it, m_e_ind);
std::fill(m_a_p_children, m_a_p_children + arr_size, std::fill(m_a_p_children, m_a_p_children + arr_size,
......
...@@ -587,7 +587,7 @@ namespace __gnu_debug ...@@ -587,7 +587,7 @@ namespace __gnu_debug
_M_print_string(const char* __string) const _M_print_string(const char* __string) const
{ {
const char* __start = __string; const char* __start = __string;
const char* __end = __start; const char* __finish = __start;
const int __bufsize = 128; const int __bufsize = 128;
char __buf[__bufsize]; char __buf[__bufsize];
...@@ -595,21 +595,21 @@ namespace __gnu_debug ...@@ -595,21 +595,21 @@ namespace __gnu_debug
{ {
if (*__start != '%') if (*__start != '%')
{ {
// [__start, __end) denotes the next word // [__start, __finish) denotes the next word
__end = __start; __finish = __start;
while (isalnum(*__end)) while (isalnum(*__finish))
++__end; ++__finish;
if (__start == __end) if (__start == __finish)
++__end; ++__finish;
if (isspace(*__end)) if (isspace(*__finish))
++__end; ++__finish;
const ptrdiff_t __len = __end - __start; const ptrdiff_t __len = __finish - __start;
assert(__len < __bufsize); assert(__len < __bufsize);
memcpy(__buf, __start, __len); memcpy(__buf, __start, __len);
__buf[__len] = '\0'; __buf[__len] = '\0';
_M_print_word(__buf); _M_print_word(__buf);
__start = __end; __start = __finish;
// Skip extra whitespace // Skip extra whitespace
while (*__start == ' ') while (*__start == ' ')
......
...@@ -423,7 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -423,7 +423,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__bin._M_address = __address; __bin._M_address = __address;
char* __c = static_cast<char*>(__v) + sizeof(_Block_address); char* __c = static_cast<char*>(__v) + sizeof(_Block_address);
_Block_record* __block = reinterpret_cast<_Block_record*>(__c); __block = reinterpret_cast<_Block_record*>(__c);
__bin._M_first[0] = __block; __bin._M_first[0] = __block;
while (--__block_count > 0) while (--__block_count > 0)
{ {
...@@ -505,8 +505,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -505,8 +505,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
const size_t __k = sizeof(_Thread_record) const size_t __k = sizeof(_Thread_record)
* _M_options._M_max_threads; * _M_options._M_max_threads;
__v = ::operator new(__k); __v = ::operator new(__k);
_Thread_record* _M_thread_freelist _M_thread_freelist = static_cast<_Thread_record*>(__v);
= static_cast<_Thread_record*>(__v);
// NOTE! The first assignable thread id is 1 since the // NOTE! The first assignable thread id is 1 since the
// global pool uses id 0 // global pool uses id 0
...@@ -528,8 +527,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -528,8 +527,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
// _M_thread_freelist. // _M_thread_freelist.
__gthread_key_create(&freelist._M_key, __gthread_key_create(&freelist._M_key,
::_M_destroy_thread_key); ::_M_destroy_thread_key);
freelist._M_thread_freelist freelist._M_thread_freelist = _M_thread_freelist;
= _M_thread_freelist;
} }
else else
{ {
...@@ -552,10 +550,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -552,10 +550,8 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
} }
::operator delete(static_cast<void*>(_M_old_array)); ::operator delete(static_cast<void*>(_M_old_array));
} }
freelist._M_thread_freelist_array freelist._M_thread_freelist_array = _M_thread_freelist;
= _M_thread_freelist; freelist._M_max_threads = _M_options._M_max_threads;
freelist._M_max_threads
= _M_options._M_max_threads;
} }
} }
...@@ -571,6 +567,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -571,6 +567,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__v = ::operator new(sizeof(size_t) * __max_threads); __v = ::operator new(sizeof(size_t) * __max_threads);
std::memset(__v, 0, sizeof(size_t) * __max_threads); std::memset(__v, 0, sizeof(size_t) * __max_threads);
__bin._M_free = static_cast<size_t*>(__v); __bin._M_free = static_cast<size_t*>(__v);
__v = ::operator new(sizeof(size_t) * __max_threads __v = ::operator new(sizeof(size_t) * __max_threads
...@@ -630,8 +627,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -630,8 +627,7 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
} }
} }
__gthread_setspecific(freelist._M_key, __gthread_setspecific(freelist._M_key, (void*)_M_id);
(void*)_M_id);
} }
return _M_id >= _M_options._M_max_threads ? 0 : _M_id; return _M_id >= _M_options._M_max_threads ? 0 : _M_id;
} }
...@@ -697,14 +693,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx) ...@@ -697,14 +693,12 @@ _GLIBCXX_BEGIN_NAMESPACE(__gnu_cxx)
__gnu_cxx::__scoped_lock sentry(freelist_mutex); __gnu_cxx::__scoped_lock sentry(freelist_mutex);
if (!freelist._M_thread_freelist_array if (!freelist._M_thread_freelist_array
|| freelist._M_max_threads || freelist._M_max_threads < _M_options._M_max_threads)
< _M_options._M_max_threads)
{ {
const size_t __k = sizeof(_Thread_record) const size_t __k = sizeof(_Thread_record)
* _M_options._M_max_threads; * _M_options._M_max_threads;
__v = ::operator new(__k); __v = ::operator new(__k);
_Thread_record* _M_thread_freelist _M_thread_freelist = static_cast<_Thread_record*>(__v);
= static_cast<_Thread_record*>(__v);
// NOTE! The first assignable thread id is 1 since the // NOTE! The first assignable thread id is 1 since the
// global pool uses id 0 // global pool uses id 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment