diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 5f760d2b5a35..74d29494afb2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2004-04-21 Paolo Carlini <pcarlini@suse.de> + + * include/bits/deque.tcc: Trivial formatting fixes. + * include/bits/stl_deque.h: Likewise. + * include/bits/stl_list.h: Likewise. + * include/bits/stl_tree.h: Likewise. + 2004-04-21 Paolo Carlini <pcarlini@suse.de> Andrew Pinski <pinskia@physics.uc.edu> diff --git a/libstdc++-v3/include/bits/deque.tcc b/libstdc++-v3/include/bits/deque.tcc index e8e043886abb..84191f5d91a9 100644 --- a/libstdc++-v3/include/bits/deque.tcc +++ b/libstdc++-v3/include/bits/deque.tcc @@ -131,7 +131,8 @@ namespace _GLIBCXX_STD deque<_Tp,_Alloc>:: erase(iterator __first, iterator __last) { - if (__first == this->_M_impl._M_start && __last == this->_M_impl._M_finish) + if (__first == this->_M_impl._M_start + && __last == this->_M_impl._M_finish) { clear(); return this->_M_impl._M_finish; @@ -139,13 +140,15 @@ namespace _GLIBCXX_STD else { const difference_type __n = __last - __first; - const difference_type __elems_before = __first - this->_M_impl._M_start; + const difference_type __elems_before = (__first + - this->_M_impl._M_start); if (static_cast<size_type>(__elems_before) < (size() - __n) / 2) { std::copy_backward(this->_M_impl._M_start, __first, __last); iterator __new_start = this->_M_impl._M_start + __n; std::_Destroy(this->_M_impl._M_start, __new_start); - _M_destroy_nodes(this->_M_impl._M_start._M_node, __new_start._M_node); + _M_destroy_nodes(this->_M_impl._M_start._M_node, + __new_start._M_node); this->_M_impl._M_start = __new_start; } else @@ -176,12 +179,15 @@ namespace _GLIBCXX_STD if (this->_M_impl._M_start._M_node != this->_M_impl._M_finish._M_node) { - std::_Destroy(this->_M_impl._M_start._M_cur, this->_M_impl._M_start._M_last); - std::_Destroy(this->_M_impl._M_finish._M_first, this->_M_impl._M_finish._M_cur); + std::_Destroy(this->_M_impl._M_start._M_cur, + this->_M_impl._M_start._M_last); + std::_Destroy(this->_M_impl._M_finish._M_first, + this->_M_impl._M_finish._M_cur); _M_deallocate_node(this->_M_impl._M_finish._M_first); } else - std::_Destroy(this->_M_impl._M_start._M_cur, this->_M_impl._M_finish._M_cur); + std::_Destroy(this->_M_impl._M_start._M_cur, + this->_M_impl._M_finish._M_cur); this->_M_impl._M_finish = this->_M_impl._M_start; } @@ -217,7 +223,8 @@ namespace _GLIBCXX_STD } catch(...) { - _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); + _M_destroy_nodes(__new_start._M_node, + this->_M_impl._M_start._M_node); __throw_exception_again; } } @@ -226,7 +233,8 @@ namespace _GLIBCXX_STD iterator __new_finish = _M_reserve_elements_at_back(__n); try { - std::uninitialized_fill(this->_M_impl._M_finish, __new_finish, __x); + std::uninitialized_fill(this->_M_impl._M_finish, + __new_finish, __x); this->_M_impl._M_finish = __new_finish; } catch(...) @@ -305,11 +313,13 @@ namespace _GLIBCXX_STD std::uninitialized_copy(__first, __mid, *__cur_node); __first = __mid; } - std::uninitialized_copy(__first, __last, this->_M_impl._M_finish._M_first); + std::uninitialized_copy(__first, __last, + this->_M_impl._M_finish._M_first); } catch(...) { - std::_Destroy(this->_M_impl._M_start, iterator(*__cur_node, __cur_node)); + std::_Destroy(this->_M_impl._M_start, + iterator(*__cur_node, __cur_node)); __throw_exception_again; } } @@ -326,7 +336,8 @@ namespace _GLIBCXX_STD try { std::_Construct(this->_M_impl._M_finish._M_cur, __t_copy); - this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node + 1); + this->_M_impl._M_finish._M_set_node(this->_M_impl._M_finish._M_node + + 1); this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first; } catch(...) @@ -347,7 +358,8 @@ namespace _GLIBCXX_STD *(this->_M_impl._M_start._M_node - 1) = this->_M_allocate_node(); try { - this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node - 1); + this->_M_impl._M_start._M_set_node(this->_M_impl._M_start._M_node + - 1); this->_M_impl._M_start._M_cur = this->_M_impl._M_start._M_last - 1; std::_Construct(this->_M_impl._M_start._M_cur, __t_copy); } @@ -370,10 +382,11 @@ namespace _GLIBCXX_STD std::_Destroy(this->_M_impl._M_finish._M_cur); } - // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1. Note that - // if the deque has at least one element (a precondition for this member - // function), and if _M_impl._M_start._M_cur == _M_impl._M_start._M_last, then the deque - // must have at least two nodes. + // Called only if _M_impl._M_start._M_cur == _M_impl._M_start._M_last - 1. + // Note that if the deque has at least one element (a precondition for this + // member function), and if + // _M_impl._M_start._M_cur == _M_impl._M_start._M_last, + // then the deque must have at least two nodes. template <typename _Tp, typename _Alloc> void deque<_Tp,_Alloc>:: _M_pop_front_aux() @@ -412,7 +425,8 @@ namespace _GLIBCXX_STD } catch(...) { - _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); + _M_destroy_nodes(__new_start._M_node, + this->_M_impl._M_start._M_node); __throw_exception_again; } } @@ -421,7 +435,8 @@ namespace _GLIBCXX_STD iterator __new_finish = _M_reserve_elements_at_back(__n); try { - std::uninitialized_copy(__first, __last, this->_M_impl._M_finish); + std::uninitialized_copy(__first, __last, + this->_M_impl._M_finish); this->_M_impl._M_finish = __new_finish; } catch(...) @@ -485,7 +500,8 @@ namespace _GLIBCXX_STD { if (__elems_before >= difference_type(__n)) { - iterator __start_n = this->_M_impl._M_start + difference_type(__n); + iterator __start_n = (this->_M_impl._M_start + + difference_type(__n)); std::uninitialized_copy(this->_M_impl._M_start, __start_n, __new_start); this->_M_impl._M_start = __new_start; @@ -494,16 +510,18 @@ namespace _GLIBCXX_STD } else { - std::__uninitialized_copy_fill(this->_M_impl._M_start, __pos, - __new_start, - this->_M_impl._M_start, __x_copy); + std::__uninitialized_copy_fill(this->_M_impl._M_start, + __pos, __new_start, + this->_M_impl._M_start, + __x_copy); this->_M_impl._M_start = __new_start; std::fill(__old_start, __pos, __x_copy); } } catch(...) { - _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); + _M_destroy_nodes(__new_start._M_node, + this->_M_impl._M_start._M_node); __throw_exception_again; } } @@ -518,7 +536,8 @@ namespace _GLIBCXX_STD { if (__elems_after > difference_type(__n)) { - iterator __finish_n = this->_M_impl._M_finish - difference_type(__n); + iterator __finish_n = (this->_M_impl._M_finish + - difference_type(__n)); std::uninitialized_copy(__finish_n, this->_M_impl._M_finish, this->_M_impl._M_finish); this->_M_impl._M_finish = __new_finish; @@ -563,7 +582,8 @@ namespace _GLIBCXX_STD { if (__elemsbefore >= difference_type(__n)) { - iterator __start_n = this->_M_impl._M_start + difference_type(__n); + iterator __start_n = (this->_M_impl._M_start + + difference_type(__n)); std::uninitialized_copy(this->_M_impl._M_start, __start_n, __new_start); this->_M_impl._M_start = __new_start; @@ -574,15 +594,17 @@ namespace _GLIBCXX_STD { _ForwardIterator __mid = __first; std::advance(__mid, difference_type(__n) - __elemsbefore); - std::__uninitialized_copy_copy(this->_M_impl._M_start, __pos, - __first, __mid, __new_start); + std::__uninitialized_copy_copy(this->_M_impl._M_start, + __pos, __first, __mid, + __new_start); this->_M_impl._M_start = __new_start; std::copy(__mid, __last, __old_start); } } catch(...) { - _M_destroy_nodes(__new_start._M_node, this->_M_impl._M_start._M_node); + _M_destroy_nodes(__new_start._M_node, + this->_M_impl._M_start._M_node); __throw_exception_again; } } @@ -597,7 +619,8 @@ namespace _GLIBCXX_STD { if (__elemsafter > difference_type(__n)) { - iterator __finish_n = this->_M_impl._M_finish - difference_type(__n); + iterator __finish_n = (this->_M_impl._M_finish + - difference_type(__n)); std::uninitialized_copy(__finish_n, this->_M_impl._M_finish, this->_M_impl._M_finish); diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index c2f01a00d310..a3d9f51ea39a 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -359,15 +359,15 @@ namespace _GLIBCXX_STD get_allocator() const { return *static_cast<const _Alloc*>(&this->_M_impl); } - typedef _Deque_iterator<_Tp,_Tp&,_Tp*> iterator; - typedef _Deque_iterator<_Tp,const _Tp&,const _Tp*> const_iterator; + typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator; + typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator; _Deque_base(const allocator_type& __a, size_t __num_elements) - : _M_impl(__a) + : _M_impl(__a) { _M_initialize_map(__num_elements); } _Deque_base(const allocator_type& __a) - : _M_impl(__a) + : _M_impl(__a) { } ~_Deque_base(); @@ -377,14 +377,15 @@ namespace _GLIBCXX_STD //standard container and at the same time makes use of the EBO //for empty allocators. struct _Deque_impl - : public _Alloc { + : public _Alloc + { _Tp** _M_map; size_t _M_map_size; iterator _M_start; iterator _M_finish; _Deque_impl(const _Alloc& __a) - : _Alloc(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish() + : _Alloc(__a), _M_map(0), _M_map_size(0), _M_start(), _M_finish() { } }; @@ -422,7 +423,8 @@ namespace _GLIBCXX_STD { if (this->_M_impl._M_map) { - _M_destroy_nodes(this->_M_impl._M_start._M_node, this->_M_impl._M_finish._M_node + 1); + _M_destroy_nodes(this->_M_impl._M_start._M_node, + this->_M_impl._M_finish._M_node + 1); _M_deallocate_map(this->_M_impl._M_map, this->_M_impl._M_map_size); } } @@ -452,7 +454,8 @@ namespace _GLIBCXX_STD // the beginning of _M_map, but for small maps it may be as far in as // _M_map+3. - _Tp** __nstart = this->_M_impl._M_map + (this->_M_impl._M_map_size - __num_nodes) / 2; + _Tp** __nstart = (this->_M_impl._M_map + + (this->_M_impl._M_map_size - __num_nodes) / 2); _Tp** __nfinish = __nstart + __num_nodes; try @@ -468,8 +471,9 @@ namespace _GLIBCXX_STD this->_M_impl._M_start._M_set_node(__nstart); this->_M_impl._M_finish._M_set_node(__nfinish - 1); this->_M_impl._M_start._M_cur = _M_impl._M_start._M_first; - this->_M_impl._M_finish._M_cur = this->_M_impl._M_finish._M_first + __num_elements - % __deque_buf_size(sizeof(_Tp)); + this->_M_impl._M_finish._M_cur = (this->_M_impl._M_finish._M_first + + __num_elements + % __deque_buf_size(sizeof(_Tp))); } template<typename _Tp, typename _Alloc> @@ -668,7 +672,8 @@ namespace _GLIBCXX_STD */ deque(const deque& __x) : _Base(__x.get_allocator(), __x.size()) - { std::uninitialized_copy(__x.begin(), __x.end(), this->_M_impl._M_start); } + { std::uninitialized_copy(__x.begin(), __x.end(), + this->_M_impl._M_start); } /** * @brief Builds a %deque from a range. @@ -1009,7 +1014,8 @@ namespace _GLIBCXX_STD void push_back(const value_type& __x) { - if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_last - 1) + if (this->_M_impl._M_finish._M_cur + != this->_M_impl._M_finish._M_last - 1) { std::_Construct(this->_M_impl._M_finish._M_cur, __x); ++this->_M_impl._M_finish._M_cur; @@ -1029,7 +1035,8 @@ namespace _GLIBCXX_STD void pop_front() { - if (this->_M_impl._M_start._M_cur != this->_M_impl._M_start._M_last - 1) + if (this->_M_impl._M_start._M_cur + != this->_M_impl._M_start._M_last - 1) { std::_Destroy(this->_M_impl._M_start._M_cur); ++this->_M_impl._M_start._M_cur; @@ -1049,7 +1056,8 @@ namespace _GLIBCXX_STD void pop_back() { - if (this->_M_impl._M_finish._M_cur != this->_M_impl._M_finish._M_first) + if (this->_M_impl._M_finish._M_cur + != this->_M_impl._M_finish._M_first) { --this->_M_impl._M_finish._M_cur; std::_Destroy(this->_M_impl._M_finish._M_cur); @@ -1418,7 +1426,8 @@ namespace _GLIBCXX_STD void _M_reserve_map_at_front (size_type __nodes_to_add = 1) { - if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node - this->_M_impl._M_map)) + if (__nodes_to_add > size_type(this->_M_impl._M_start._M_node + - this->_M_impl._M_map)) _M_reallocate_map(__nodes_to_add, true); } diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index c94a0a9bf73b..f55915b1e2c5 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -295,10 +295,11 @@ namespace _GLIBCXX_STD _Node_Alloc_type; struct _List_impl - : public _Node_Alloc_type { + : public _Node_Alloc_type + { _List_node_base _M_node; _List_impl (const _Node_Alloc_type& __a) - : _Node_Alloc_type(__a) + : _Node_Alloc_type(__a) { } }; @@ -317,10 +318,11 @@ namespace _GLIBCXX_STD allocator_type get_allocator() const - { return allocator_type(*static_cast<const _Node_Alloc_type*>(&this->_M_impl)); } + { return allocator_type(*static_cast< + const _Node_Alloc_type*>(&this->_M_impl)); } _List_base(const allocator_type& __a) - : _M_impl(__a) + : _M_impl(__a) { _M_init(); } // This is what actually destroys the list. diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index ac9add899b92..fdc2ea607724 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -461,7 +461,8 @@ namespace std _Const_Link_type _M_begin() const - { return static_cast<_Const_Link_type>(this->_M_impl._M_header._M_parent); } + { return static_cast< + _Const_Link_type>(this->_M_impl._M_header._M_parent); } _Link_type _M_end() @@ -999,9 +1000,9 @@ namespace std inline void _Rb_tree<_Key,_Val,_KeyOfValue,_Compare,_Alloc>::erase(iterator __position) { - _Link_type __y = - static_cast<_Link_type>(_Rb_tree_rebalance_for_erase(__position._M_node, - this->_M_impl._M_header)); + _Link_type __y = static_cast< + _Link_type>(_Rb_tree_rebalance_for_erase(__position._M_node, + this->_M_impl._M_header)); destroy_node(__y); --_M_impl._M_node_count; } @@ -1278,4 +1279,3 @@ namespace std } // namespace std #endif -