Patchwork cleanup patch

login
register
mail settings
Submitter François Dumont
Date June 29, 2011, 8:16 p.m.
Message ID <4E0B8839.70005@free.fr>
Download mbox | patch
Permalink /patch/102659/
State New
Headers show

Comments

François Dumont - June 29, 2011, 8:16 p.m.
Attached patch applied

2011-06-29  François Dumont <francois.cppdevs@free.fr>

         * include/debug/set.h, unordered_map, multiset.h, forward_list,
         unordered_set, vector, deque, string, list, multimap.h: Remove base
         class default constructor calls.
         * include/debug/map.h: Likewise and cleanup several redefinition of
         base iterator typedef.

Regards

On 06/29/2011 10:34 AM, Jonathan Wakely wrote:
> On 28 June 2011 21:36, François Dumont wrote:
>> Here is a small patch to cleanup debug code.
>>
>> 2011-06-28  François Dumont<francois.cppdevs@free.fr>
>>
>>         * include/debug/set.h, unordered_map, multiset.h, forward_list,
>>         unordered_set, vector, deque, string, list, multimap.h: Remove base
>>         class default constructor calls.
>>         * include/debug/map.h: Likewise and cleanup several redefinition of
>>         base iterator typedef.
>>
>>
>> Tested under linux x86_64.
> (Remember to CC gcc-patches for all patches)
>
> This is OK to check in, thanks.
>

Patch

Index: include/debug/set.h
===================================================================
--- include/debug/set.h	(revision 175553)
+++ include/debug/set.h	(working copy)
@@ -46,7 +46,6 @@ 
       public __gnu_debug::_Safe_sequence<set<_Key, _Compare, _Allocator> >
     {
       typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<set> _Safe_base;
 
       typedef typename _Base::const_iterator _Base_const_iterator;
       typedef typename _Base::iterator _Base_iterator;
@@ -88,21 +87,21 @@ 
 		__comp, __a) { }
 
       set(const set& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       set(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       set(set&& __x)
       noexcept(is_nothrow_copy_constructible<_Compare>::value)
-      : _Base(std::move(__x)), _Safe_base()
+      : _Base(std::move(__x))
       { this->_M_swap(__x); }
 
       set(initializer_list<value_type> __l,
 	  const _Compare& __comp = _Compare(),
 	  const allocator_type& __a = allocator_type())
-      : _Base(__l, __comp, __a), _Safe_base() { }
+      : _Base(__l, __comp, __a) { }
 #endif
 
       ~set() _GLIBCXX_NOEXCEPT { }
@@ -206,7 +205,6 @@ 
       std::pair<iterator, bool>
       insert(value_type&& __x)
       {
-	typedef typename _Base::iterator _Base_iterator;
 	std::pair<_Base_iterator, bool> __res
 	  = _Base::insert(std::move(__x));
 	return std::pair<iterator, bool>(iterator(__res.first, this),
Index: include/debug/unordered_map
===================================================================
--- include/debug/unordered_map	(revision 175553)
+++ include/debug/unordered_map	(working copy)
@@ -89,25 +89,25 @@ 
 	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
 								     __last)),
 		__gnu_debug::__base(__last), __n,
-		__hf, __eql, __a), _Safe_base() { }
+		__hf, __eql, __a) { }
 
       unordered_map(const unordered_map& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_map(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_map(unordered_map&& __x)
       noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
 	              is_nothrow_copy_constructible<_Pred>>::value)
-      : _Base(std::move(__x)), _Safe_base() { }
+      : _Base(std::move(__x)) { }
 
       unordered_map(initializer_list<value_type> __l,
 		    size_type __n = 0,
 		    const hasher& __hf = hasher(),
 		    const key_equal& __eql = key_equal(),
 		    const allocator_type& __a = allocator_type())
-      : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+      : _Base(__l, __n, __hf, __eql, __a) { }
 
       ~unordered_map() noexcept { }
 
@@ -381,25 +381,25 @@ 
 	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
 								     __last)),
 		__gnu_debug::__base(__last), __n,
-		__hf, __eql, __a), _Safe_base() { }
+		__hf, __eql, __a) { }
 
       unordered_multimap(const unordered_multimap& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_multimap(const _Base& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_multimap(unordered_multimap&& __x)
       noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
 	              is_nothrow_copy_constructible<_Pred>>::value)
-      : _Base(std::move(__x)), _Safe_base() { }
+      : _Base(std::move(__x)) { }
 
       unordered_multimap(initializer_list<value_type> __l,
 			 size_type __n = 0,
 			 const hasher& __hf = hasher(),
 			 const key_equal& __eql = key_equal(),
 			 const allocator_type& __a = allocator_type())
-      : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+      : _Base(__l, __n, __hf, __eql, __a) { }
 
       ~unordered_multimap() noexcept { }
 
Index: include/debug/multiset.h
===================================================================
--- include/debug/multiset.h	(revision 175553)
+++ include/debug/multiset.h	(working copy)
@@ -46,7 +46,6 @@ 
       public __gnu_debug::_Safe_sequence<multiset<_Key, _Compare, _Allocator> >
     {
       typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<multiset> _Safe_base;
 
       typedef typename _Base::const_iterator _Base_const_iterator;
       typedef typename _Base::iterator _Base_iterator;
@@ -88,21 +87,21 @@ 
 		__comp, __a) { }
 
       multiset(const multiset& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       multiset(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       multiset(multiset&& __x)
       noexcept(is_nothrow_copy_constructible<_Compare>::value)
-      : _Base(std::move(__x)), _Safe_base()
+      : _Base(std::move(__x))
       { this->_M_swap(__x); }
 
       multiset(initializer_list<value_type> __l,
 	       const _Compare& __comp = _Compare(),
 	       const allocator_type& __a = allocator_type())
-      : _Base(__l, __comp, __a), _Safe_base() { }
+      : _Base(__l, __comp, __a) { }
 #endif
 
       ~multiset() _GLIBCXX_NOEXCEPT { }
Index: include/debug/forward_list
===================================================================
--- include/debug/forward_list	(revision 175553)
+++ include/debug/forward_list	(working copy)
@@ -46,7 +46,6 @@ 
       public __gnu_debug::_Safe_sequence<forward_list<_Tp, _Alloc> >
     {
       typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base;
-      typedef __gnu_debug::_Safe_sequence<forward_list> _Safe_base;
 
       typedef typename _Base::iterator       _Base_iterator;
       typedef typename _Base::const_iterator _Base_const_iterator;
Index: include/debug/vector
===================================================================
--- include/debug/vector	(revision 175553)
+++ include/debug/vector	(working copy)
@@ -47,7 +47,6 @@ 
       public __gnu_debug::_Safe_sequence<vector<_Tp, _Allocator> >
     {
       typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<vector>              _Safe_base;
 
       typedef typename _Base::iterator _Base_iterator;
       typedef typename _Base::const_iterator _Base_const_iterator;
@@ -102,15 +101,15 @@ 
         { _M_update_guaranteed_capacity(); }
 
       vector(const vector& __x)
-      : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
+      : _Base(__x), _M_guaranteed_capacity(__x.size()) { }
 
       /// Construction from a release-mode vector
       vector(const _Base& __x)
-      : _Base(__x), _Safe_base(), _M_guaranteed_capacity(__x.size()) { }
+      : _Base(__x), _M_guaranteed_capacity(__x.size()) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       vector(vector&& __x) noexcept
-      : _Base(std::move(__x)), _Safe_base(),
+      : _Base(std::move(__x)),
 	_M_guaranteed_capacity(this->size())
       {
 	this->_M_swap(__x);
@@ -119,7 +118,7 @@ 
 
       vector(initializer_list<value_type> __l,
 	     const allocator_type& __a = allocator_type())
-      : _Base(__l, __a), _Safe_base(),
+      : _Base(__l, __a),
 	_M_guaranteed_capacity(__l.size()) { }
 #endif
 
Index: include/debug/unordered_set
===================================================================
--- include/debug/unordered_set	(revision 175553)
+++ include/debug/unordered_set	(working copy)
@@ -89,25 +89,25 @@ 
 	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
 								     __last)),
 		__gnu_debug::__base(__last), __n,
-		__hf, __eql, __a), _Safe_base() { }
+		__hf, __eql, __a) { }
 
       unordered_set(const unordered_set& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_set(const _Base& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_set(unordered_set&& __x)
       noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
 	              is_nothrow_copy_constructible<_Pred>>::value)
-      : _Base(std::move(__x)), _Safe_base() { }
+      : _Base(std::move(__x)) { }
 
       unordered_set(initializer_list<value_type> __l,
 		    size_type __n = 0,
 		    const hasher& __hf = hasher(),
 		    const key_equal& __eql = key_equal(),
 		    const allocator_type& __a = allocator_type())
-      : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+      : _Base(__l, __n, __hf, __eql, __a) { }
 
       ~unordered_set() noexcept { }
 
@@ -370,25 +370,25 @@ 
 	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
 								     __last)),
 		__gnu_debug::__base(__last), __n,
-		__hf, __eql, __a), _Safe_base() { }
+		__hf, __eql, __a) { }
 
       unordered_multiset(const unordered_multiset& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_multiset(const _Base& __x) 
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       unordered_multiset(unordered_multiset&& __x)
       noexcept(__and_<is_nothrow_copy_constructible<_Hash>,
 	              is_nothrow_copy_constructible<_Pred>>::value)
-      : _Base(std::move(__x)), _Safe_base() { }
+      : _Base(std::move(__x)) { }
 
       unordered_multiset(initializer_list<value_type> __l,
 			 size_type __n = 0,
 			 const hasher& __hf = hasher(),
 			 const key_equal& __eql = key_equal(),
 			 const allocator_type& __a = allocator_type())
-      : _Base(__l, __n, __hf, __eql, __a), _Safe_base() { }
+      : _Base(__l, __n, __hf, __eql, __a) { }
 
       ~unordered_multiset() noexcept { }
 
Index: include/debug/map.h
===================================================================
--- include/debug/map.h	(revision 175553)
+++ include/debug/map.h	(working copy)
@@ -46,7 +46,6 @@ 
       public __gnu_debug::_Safe_sequence<map<_Key, _Tp, _Compare, _Allocator> >
     {
       typedef _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<map> _Safe_base;
 
       typedef typename _Base::const_iterator _Base_const_iterator;
       typedef typename _Base::iterator _Base_iterator;
@@ -61,9 +60,9 @@ 
       typedef typename _Base::reference             reference;
       typedef typename _Base::const_reference       const_reference;
 
-      typedef __gnu_debug::_Safe_iterator<typename _Base::iterator, map>
+      typedef __gnu_debug::_Safe_iterator<_Base_iterator, map>
                                                     iterator;
-      typedef __gnu_debug::_Safe_iterator<typename _Base::const_iterator, map>
+      typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, map>
                                                     const_iterator;
 
       typedef typename _Base::size_type             size_type;
@@ -85,24 +84,24 @@ 
 	: _Base(__gnu_debug::__base(__gnu_debug::__check_valid_range(__first,
 								     __last)),
 		__gnu_debug::__base(__last),
-		__comp, __a), _Safe_base() { }
+		__comp, __a) { }
 
       map(const map& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       map(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       map(map&& __x)
       noexcept(is_nothrow_copy_constructible<_Compare>::value)
-      : _Base(std::move(__x)), _Safe_base()
+      : _Base(std::move(__x))
       { this->_M_swap(__x); }
 
       map(initializer_list<value_type> __l,
 	  const _Compare& __c = _Compare(),
 	  const allocator_type& __a = allocator_type())
-      : _Base(__l, __c, __a), _Safe_base() { }
+      : _Base(__l, __c, __a) { }
 #endif
 
       ~map() _GLIBCXX_NOEXCEPT { }
@@ -206,7 +205,6 @@ 
       std::pair<iterator, bool>
       insert(const value_type& __x)
       {
-	typedef typename _Base::iterator _Base_iterator;
 	std::pair<_Base_iterator, bool> __res = _Base::insert(__x);
 	return std::pair<iterator, bool>(iterator(__res.first, this),
 					 __res.second);
@@ -219,7 +217,6 @@ 
         std::pair<iterator, bool>
         insert(_Pair&& __x)
         {
-	  typedef typename _Base::iterator _Base_iterator;
 	  std::pair<_Base_iterator, bool> __res
 	    = _Base::insert(std::forward<_Pair>(__x));
 	  return std::pair<iterator, bool>(iterator(__res.first, this),
@@ -384,7 +381,6 @@ 
       std::pair<iterator,iterator>
       equal_range(const key_type& __x)
       {
-	typedef typename _Base::iterator _Base_iterator;
 	std::pair<_Base_iterator, _Base_iterator> __res =
 	_Base::equal_range(__x);
 	return std::make_pair(iterator(__res.first, this),
@@ -394,7 +390,6 @@ 
       std::pair<const_iterator,const_iterator>
       equal_range(const key_type& __x) const
       {
-	typedef typename _Base::const_iterator _Base_const_iterator;
 	std::pair<_Base_const_iterator, _Base_const_iterator> __res =
 	_Base::equal_range(__x);
 	return std::make_pair(const_iterator(__res.first, this),
@@ -411,7 +406,6 @@ 
       void
       _M_invalidate_all()
       {
-	typedef typename _Base::const_iterator _Base_const_iterator;
 	typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal;
 	this->_M_invalidate_if(_Not_equal(_M_base().end()));
       }
Index: include/debug/deque
===================================================================
--- include/debug/deque	(revision 175553)
+++ include/debug/deque	(working copy)
@@ -45,7 +45,6 @@ 
       public __gnu_debug::_Safe_sequence<deque<_Tp, _Allocator> >
     {
       typedef  _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<deque> _Safe_base;
 
       typedef typename _Base::const_iterator _Base_const_iterator;
       typedef typename _Base::iterator _Base_iterator;
@@ -98,19 +97,19 @@ 
         { }
 
       deque(const deque& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       deque(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       deque(deque&& __x)
-      : _Base(std::move(__x)), _Safe_base()
+      : _Base(std::move(__x))
       { this->_M_swap(__x); }
 
       deque(initializer_list<value_type> __l,
 	    const allocator_type& __a = allocator_type())
-      : _Base(__l, __a), _Safe_base() { }
+      : _Base(__l, __a) { }
 #endif
 
       ~deque() _GLIBCXX_NOEXCEPT { }
Index: include/debug/string
===================================================================
--- include/debug/string	(revision 175553)
+++ include/debug/string	(working copy)
@@ -75,12 +75,12 @@ 
     { }
 
     // Provides conversion from a release-mode string to a debug-mode string
-    basic_string(const _Base& __base) : _Base(__base), _Safe_base() { }
+    basic_string(const _Base& __base) : _Base(__base) { }
 
     // _GLIBCXX_RESOLVE_LIB_DEFECTS
     // 42. string ctors specify wrong default allocator
     basic_string(const basic_string& __str)
-    : _Base(__str, 0, _Base::npos, __str.get_allocator()), _Safe_base()
+    : _Base(__str, 0, _Base::npos, __str.get_allocator())
     { }
 
     // _GLIBCXX_RESOLVE_LIB_DEFECTS
Index: include/debug/list
===================================================================
--- include/debug/list	(revision 175553)
+++ include/debug/list	(working copy)
@@ -45,7 +45,6 @@ 
       public __gnu_debug::_Safe_sequence<list<_Tp, _Allocator> >
     {
       typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<list>  _Safe_base;
 
       typedef typename _Base::iterator       _Base_iterator;
       typedef typename _Base::const_iterator _Base_const_iterator;
@@ -100,19 +99,19 @@ 
 
 
       list(const list& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       list(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       list(list&& __x) noexcept
-      : _Base(std::move(__x)), _Safe_base()
+      : _Base(std::move(__x))
       { this->_M_swap(__x); }
 
       list(initializer_list<value_type> __l,
            const allocator_type& __a = allocator_type())
-        : _Base(__l, __a), _Safe_base() { }
+        : _Base(__l, __a) { }
 #endif
 
       ~list() _GLIBCXX_NOEXCEPT { }
@@ -395,7 +394,7 @@ 
       insert(iterator __p, initializer_list<value_type> __l)
       {
 	__glibcxx_check_insert(__p);
-	_Base::insert(__p, __l);
+	_Base::insert(__p.base(), __l);
       }
 #endif
 
Index: include/debug/multimap.h
===================================================================
--- include/debug/multimap.h	(revision 175553)
+++ include/debug/multimap.h	(working copy)
@@ -47,7 +47,6 @@ 
 						  _Compare, _Allocator> >
     {
       typedef _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> _Base;
-      typedef __gnu_debug::_Safe_sequence<multimap> _Safe_base;
 
       typedef typename _Base::const_iterator _Base_const_iterator;
       typedef typename _Base::iterator _Base_iterator;
@@ -89,21 +88,21 @@ 
 	      __comp, __a) { }
 
       multimap(const multimap& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
       multimap(const _Base& __x)
-      : _Base(__x), _Safe_base() { }
+      : _Base(__x) { }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
       multimap(multimap&& __x)
       noexcept(is_nothrow_copy_constructible<_Compare>::value)
-      : _Base(std::move(__x)), _Safe_base()
+      : _Base(std::move(__x))
       { this->_M_swap(__x); }
 
       multimap(initializer_list<value_type> __l,
 	       const _Compare& __c = _Compare(),
 	       const allocator_type& __a = allocator_type())
-      : _Base(__l, __c, __a), _Safe_base() { }
+      : _Base(__l, __c, __a) { }
 #endif
 
       ~multimap() _GLIBCXX_NOEXCEPT { }