[_GLIBCXX_DEBUG] Code cleanup/simplification

Message ID 8c49ed0b-6c4f-7663-47a9-7c7f31b47c04@gmail.com
State Committed
Commit e9a53a4f764c37b50aff68811c5d37fcd6f38adb
Headers
Series [_GLIBCXX_DEBUG] Code cleanup/simplification |

Commit Message

François Dumont Nov. 13, 2021, 1:17 p.m. UTC
  libstdc++: [_GLIBCXX_DEBUG] Remove _Safe_container<>::_M_safe()

     Container code cleanup to get rid of _Safe_container<>::_M_safe() 
and just
     _Safe:: calls which use normal inheritance. Also remove several 
usages of _M_base()
     which can be most of the time ommitted and sometimes replace with 
explicit _Base::
     calls.

     libstdc++-v3/ChangeLog:

             * include/debug/safe_container.h 
(_Safe_container<>::_M_safe): Remove.
             * include/debug/deque 
(deque::operator=(initializer_list<>)): Replace
             _M_base() call with _Base:: call.
             (deque::operator[](size_type)): Likewise.
             * include/debug/forward_list (forward_list(forward_list&&, 
const allocator_type&):
             Remove _M_safe() and _M_base() calls.
             (forward_list::operator=(initializer_list<>)): Remove 
_M_base() calls.
             (forward_list::splice_after, forward_list::merge): Likewise.
             * include/debug/list (list(list&&, const allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (list::operator=(initializer_list<>)): Remove _M_base() calls.
             (list::splice, list::merge): Likewise.
             * include/debug/map.h (map(map&&, const allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (map::operator=(initializer_list<>)): Remove _M_base() calls.
             * include/debug/multimap.h (multimap(multimap&&, const 
allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (multimap::operator=(initializer_list<>)): Remove _M_base() 
calls.
             * include/debug/set.h (set(set&&, const allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (set::operator=(initializer_list<>)): Remove _M_base() calls.
             * include/debug/multiset.h (multiset(multiset&&, const 
allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (multiset::operator=(initializer_list<>)): Remove _M_base() 
calls.
             * include/debug/string (basic_string(basic_string&&, const 
allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (basic_string::operator=(initializer_list<>)): Remove 
_M_base() call.
             (basic_string::operator=(const _CharT*), 
basic_string::operator=(_CharT)): Likewise.
             (basic_string::operator[](size_type), 
basic_string::operator+=(const basic_string&)): Likewise.
             (basic_string::operator+=(const _Char*), 
basic_string::operator+=(_CharT)): Likewise.
             * include/debug/unordered_map 
(unordered_map(unordered_map&&, const allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (unordered_map::operator=(initializer_list<>), 
unordered_map::merge): Remove _M_base() calls.
             (unordered_multimap(unordered_multimap&&, const 
allocator_type&)):
             Remove _M_safe() and _M_base() calls.
(unordered_multimap::operator=(initializer_list<>), 
unordered_multimap::merge):
             Remove _M_base() calls.
             * include/debug/unordered_set 
(unordered_set(unordered_set&&, const allocator_type&)):
             Remove _M_safe() and _M_base() calls.
             (unordered_set::operator=(initializer_list<>), 
unordered_set::merge): Remove _M_base() calls.
             (unordered_multiset(unordered_multiset&&, const 
allocator_type&)):
             Remove _M_safe() and _M_base() calls.
(unordered_multiset::operator=(initializer_list<>), 
unordered_multiset::merge):
             Remove _M_base() calls.
             * include/debug/vector (vector(vector&&, const 
allocator_type&):
             Remove _M_safe() and _M_base() calls.
             (vector::operator=(initializer_list<>)): Remove _M_base() 
calls.
             (vector::operator[](size_type)): Likewise.

Tested under Linux x86_64 _GLIBCXX_DEBUG mode -std=gnu++14 and -std=gnu++98.

Ok to commit ?

François
  

Comments

Jonathan Wakely Nov. 14, 2021, 5:12 p.m. UTC | #1
On Sat, 13 Nov 2021 at 13:19, François Dumont via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
>      libstdc++: [_GLIBCXX_DEBUG] Remove _Safe_container<>::_M_safe()
>
>      Container code cleanup to get rid of _Safe_container<>::_M_safe()
> and just
>      _Safe:: calls which use normal inheritance. Also remove several
> usages of _M_base()
>      which can be most of the time ommitted and sometimes replace with
> explicit _Base::
>      calls.
>
>      libstdc++-v3/ChangeLog:
>
>              * include/debug/safe_container.h
> (_Safe_container<>::_M_safe): Remove.
>              * include/debug/deque
> (deque::operator=(initializer_list<>)): Replace
>              _M_base() call with _Base:: call.
>              (deque::operator[](size_type)): Likewise.
>              * include/debug/forward_list (forward_list(forward_list&&,
> const allocator_type&):
>              Remove _M_safe() and _M_base() calls.
>              (forward_list::operator=(initializer_list<>)): Remove
> _M_base() calls.
>              (forward_list::splice_after, forward_list::merge): Likewise.
>              * include/debug/list (list(list&&, const allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (list::operator=(initializer_list<>)): Remove _M_base() calls.
>              (list::splice, list::merge): Likewise.
>              * include/debug/map.h (map(map&&, const allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (map::operator=(initializer_list<>)): Remove _M_base() calls.
>              * include/debug/multimap.h (multimap(multimap&&, const
> allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (multimap::operator=(initializer_list<>)): Remove _M_base()
> calls.
>              * include/debug/set.h (set(set&&, const allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (set::operator=(initializer_list<>)): Remove _M_base() calls.
>              * include/debug/multiset.h (multiset(multiset&&, const
> allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (multiset::operator=(initializer_list<>)): Remove _M_base()
> calls.
>              * include/debug/string (basic_string(basic_string&&, const
> allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (basic_string::operator=(initializer_list<>)): Remove
> _M_base() call.
>              (basic_string::operator=(const _CharT*),
> basic_string::operator=(_CharT)): Likewise.
>              (basic_string::operator[](size_type),
> basic_string::operator+=(const basic_string&)): Likewise.
>              (basic_string::operator+=(const _Char*),
> basic_string::operator+=(_CharT)): Likewise.
>              * include/debug/unordered_map
> (unordered_map(unordered_map&&, const allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (unordered_map::operator=(initializer_list<>),
> unordered_map::merge): Remove _M_base() calls.
>              (unordered_multimap(unordered_multimap&&, const
> allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
> (unordered_multimap::operator=(initializer_list<>),
> unordered_multimap::merge):
>              Remove _M_base() calls.
>              * include/debug/unordered_set
> (unordered_set(unordered_set&&, const allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
>              (unordered_set::operator=(initializer_list<>),
> unordered_set::merge): Remove _M_base() calls.
>              (unordered_multiset(unordered_multiset&&, const
> allocator_type&)):
>              Remove _M_safe() and _M_base() calls.
> (unordered_multiset::operator=(initializer_list<>),
> unordered_multiset::merge):
>              Remove _M_base() calls.
>              * include/debug/vector (vector(vector&&, const
> allocator_type&):
>              Remove _M_safe() and _M_base() calls.
>              (vector::operator=(initializer_list<>)): Remove _M_base()
> calls.
>              (vector::operator[](size_type)): Likewise.
>
> Tested under Linux x86_64 _GLIBCXX_DEBUG mode -std=gnu++14 and -std=gnu++98.
>
> Ok to commit ?

Looks good, please commit, thanks.
  

Patch

diff --git a/libstdc++-v3/include/debug/deque b/libstdc++-v3/include/debug/deque
index 52778ba1617..a73d6c34209 100644
--- a/libstdc++-v3/include/debug/deque
+++ b/libstdc++-v3/include/debug/deque
@@ -166,7 +166,7 @@  namespace __debug
       deque&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -344,7 +344,7 @@  namespace __debug
       operator[](size_type __n) _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_subscript(__n);
-	return _M_base()[__n];
+	return _Base::operator[](__n);
       }
 
       _GLIBCXX_NODISCARD
@@ -352,7 +352,7 @@  namespace __debug
       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_subscript(__n);
-	return _M_base()[__n];
+	return _Base::operator[](__n);
       }
 
       using _Base::at;
diff --git a/libstdc++-v3/include/debug/forward_list b/libstdc++-v3/include/debug/forward_list
index cae5b5f038b..6ed4853af40 100644
--- a/libstdc++-v3/include/debug/forward_list
+++ b/libstdc++-v3/include/debug/forward_list
@@ -242,8 +242,8 @@  namespace __debug
 	noexcept(
 	  std::is_nothrow_constructible<_Base,
 	    _Base, const allocator_type&>::value )
-      : _Safe(std::move(__list._M_safe()), __al),
-	_Base(std::move(__list._M_base()), __al)
+      : _Safe(std::move(__list), __al),
+	_Base(std::move(__list), __al)
       { }
 
       explicit
@@ -287,7 +287,7 @@  namespace __debug
       forward_list&
       operator=(std::initializer_list<_Tp> __il)
       {
-	_M_base() = __il;
+	_Base::operator=(__il);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -584,7 +584,7 @@  namespace __debug
 	    return __it != __list._M_base().cbefore_begin()
 		   && __it != __list._M_base().end();
 	  });
-	_Base::splice_after(__pos.base(), std::move(__list._M_base()));
+	_Base::splice_after(__pos.base(), std::move(__list));
       }
 
       void
@@ -613,8 +613,7 @@  namespace __debug
 	_Base_const_iterator __next = std::next(__i.base());
 	this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it)
 	  { return __it == __next; });
-	_Base::splice_after(__pos.base(), std::move(__list._M_base()),
-			    __i.base());
+	_Base::splice_after(__pos.base(), std::move(__list), __i.base());
       }
 
       void
@@ -669,7 +668,7 @@  namespace __debug
 	      { return __it == __tmp; });
 	  }
 
-	_Base::splice_after(__pos.base(), std::move(__list._M_base()),
+	_Base::splice_after(__pos.base(), std::move(__list),
 			    __before.base(), __last.base());
       }
 
@@ -710,7 +709,7 @@  namespace __debug
 		this->_M_invalidate_if([__next](_Base_const_iterator __it)
 				       { return __it == __next; });
 		__to_destroy.splice_after(__to_destroy.cbefore_begin(),
-					  _M_base(), __old);
+					  *this, __old);
 		__x = __old;
 		_GLIBCXX20_ONLY( __removed++ );
 	      }
@@ -739,7 +738,7 @@  namespace __debug
 		  this->_M_invalidate_if([__x](_Base_const_iterator __it)
 					 { return __it == __x; });
 		  __to_destroy.splice_after(__to_destroy.cbefore_begin(),
-					    _M_base(), __old);
+					    *this, __old);
 		  __x = __old;
 		  _GLIBCXX20_ONLY( __removed++ );
 		}
@@ -777,7 +776,7 @@  namespace __debug
 		  this->_M_invalidate_if([__next](_Base_const_iterator __it)
 					 { return __it == __next; });
 		  __to_destroy.splice_after(__to_destroy.cbefore_begin(),
-					    _M_base(), __first);
+					    *this, __first);
 		  __next = __first;
 		  _GLIBCXX20_ONLY( __removed++ );
 		}
@@ -804,7 +803,7 @@  namespace __debug
 	      return __it != __list._M_base().cbefore_begin()
 		     && __it != __list._M_base().cend();
 	    });
-	  _Base::merge(std::move(__list._M_base()));
+	  _Base::merge(std::move(__list));
 	}
       }
 
@@ -827,7 +826,7 @@  namespace __debug
 		return __it != __list._M_base().cbefore_begin()
 		       && __it != __list._M_base().cend();
 	      });
-	    _Base::merge(std::move(__list._M_base()), __comp);
+	    _Base::merge(std::move(__list), __comp);
 	  }
 	}
 
diff --git a/libstdc++-v3/include/debug/list b/libstdc++-v3/include/debug/list
index f40ebc8521e..383482c0acf 100644
--- a/libstdc++-v3/include/debug/list
+++ b/libstdc++-v3/include/debug/list
@@ -122,8 +122,8 @@  namespace __debug
 	noexcept(
 	  std::is_nothrow_constructible<_Base,
 	    _Base, const allocator_type&>::value )
-      : _Safe(std::move(__x._M_safe()), __a),
-	_Base(std::move(__x._M_base()), __a) { }
+      : _Safe(std::move(__x), __a),
+	_Base(std::move(__x), __a) { }
 #endif
 
       explicit
@@ -172,7 +172,7 @@  namespace __debug
       operator=(initializer_list<value_type> __l)
       {
 	this->_M_invalidate_all();
-	_M_base() = __l;
+	_Base::operator=(__l);
 	return *this;
       }
 
@@ -583,7 +583,7 @@  namespace __debug
 			      _M_message(__gnu_debug::__msg_self_splice)
 			      ._M_sequence(*this, "this"));
 	this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
-	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()));
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x));
       }
 
 #if __cplusplus >= 201103L
@@ -614,7 +614,7 @@  namespace __debug
 	// _GLIBCXX_RESOLVE_LIB_DEFECTS
 	// 250. splicing invalidates iterators
 	this->_M_transfer_from_if(__x, _Equal(__i.base()));
-	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x),
 		      __i.base());
       }
 
@@ -662,7 +662,7 @@  namespace __debug
 	    this->_M_transfer_from_if(__x, _Equal(__tmp));
 	  }
 
-	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()),
+	_Base::splice(__position.base(), _GLIBCXX_MOVE(__x),
 		      __first.base(), __last.base());
       }
 
@@ -709,7 +709,7 @@  namespace __debug
 		// 526. Is it undefined if a function in the standard changes
 		// in parameters?
 		this->_M_invalidate_if(_Equal(__first));
-		__to_destroy.splice(__to_destroy.begin(), _M_base(), __first);
+		__to_destroy.splice(__to_destroy.begin(), *this, __first);
 #if !_GLIBCXX_USE_CXX11_ABI
 		_GLIBCXX20_ONLY( __removed++ );
 #endif
@@ -743,7 +743,7 @@  namespace __debug
 	    if (__pred(*__x))
 	      {
 		this->_M_invalidate_if(_Equal(__x));
-		__to_destroy.splice(__to_destroy.begin(), _M_base(), __x);
+		__to_destroy.splice(__to_destroy.begin(), *this, __x);
 #if !_GLIBCXX_USE_CXX11_ABI
 		_GLIBCXX20_ONLY( __removed++ );
 #endif
@@ -780,7 +780,7 @@  namespace __debug
 	  if (*__first == *__next)
 	    {
 	      this->_M_invalidate_if(_Equal(__next));
-	      __to_destroy.splice(__to_destroy.begin(), _M_base(), __next);
+	      __to_destroy.splice(__to_destroy.begin(), *this, __next);
 	      __next = __first;
 #if !_GLIBCXX_USE_CXX11_ABI
 	      _GLIBCXX20_ONLY( __removed++ );
@@ -818,7 +818,7 @@  namespace __debug
 	    if (__binary_pred(*__first, *__next))
 	      {
 		this->_M_invalidate_if(_Equal(__next));
-		__to_destroy.splice(__to_destroy.begin(), _M_base(), __next);
+		__to_destroy.splice(__to_destroy.begin(), *this, __next);
 		__next = __first;
 #if !_GLIBCXX_USE_CXX11_ABI
 		_GLIBCXX20_ONLY( __removed++ );
@@ -851,7 +851,7 @@  namespace __debug
 	    __glibcxx_check_sorted(_Base::begin(), _Base::end());
 	    __glibcxx_check_sorted(__x.begin().base(), __x.end().base());
 	    this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
-	    _Base::merge(_GLIBCXX_MOVE(__x._M_base()));
+	    _Base::merge(_GLIBCXX_MOVE(__x));
 	  }
       }
 
@@ -878,7 +878,7 @@  namespace __debug
 	      __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(),
 					  __comp);
 	      this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end()));
-	      _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp);
+	      _Base::merge(_GLIBCXX_MOVE(__x), __comp);
 	    }
 	}
 
diff --git a/libstdc++-v3/include/debug/map.h b/libstdc++-v3/include/debug/map.h
index 3883c546871..c62f0b574e6 100644
--- a/libstdc++-v3/include/debug/map.h
+++ b/libstdc++-v3/include/debug/map.h
@@ -118,9 +118,9 @@  namespace __debug
       : _Base(__m, __a) { }
 
       map(map&& __m, const __type_identity_t<allocator_type>& __a)
-      noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
-      : _Safe(std::move(__m._M_safe()), __a),
-	_Base(std::move(__m._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__m), __a)) )
+      : _Safe(std::move(__m), __a),
+	_Base(std::move(__m), __a) { }
 
       map(initializer_list<value_type> __l, const allocator_type& __a)
       : _Base(__l, __a) { }
@@ -162,7 +162,7 @@  namespace __debug
       map&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
diff --git a/libstdc++-v3/include/debug/multimap.h b/libstdc++-v3/include/debug/multimap.h
index 073c1c39240..5f0f1faa33e 100644
--- a/libstdc++-v3/include/debug/multimap.h
+++ b/libstdc++-v3/include/debug/multimap.h
@@ -119,9 +119,9 @@  namespace __debug
       : _Base(__m, __a) { }
 
       multimap(multimap&& __m, const __type_identity_t<allocator_type>& __a)
-      noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
-      : _Safe(std::move(__m._M_safe()), __a),
-	_Base(std::move(__m._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__m), __a)) )
+      : _Safe(std::move(__m), __a),
+	_Base(std::move(__m), __a) { }
 
       multimap(initializer_list<value_type> __l, const allocator_type& __a)
       : _Base(__l, __a) { }
@@ -162,7 +162,7 @@  namespace __debug
       multimap&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
diff --git a/libstdc++-v3/include/debug/multiset.h b/libstdc++-v3/include/debug/multiset.h
index 479411d9d06..7729fc19689 100644
--- a/libstdc++-v3/include/debug/multiset.h
+++ b/libstdc++-v3/include/debug/multiset.h
@@ -118,9 +118,9 @@  namespace __debug
       : _Base(__m, __a) { }
 
       multiset(multiset&& __m, const __type_identity_t<allocator_type>& __a)
-      noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) )
-      : _Safe(std::move(__m._M_safe()), __a),
-	_Base(std::move(__m._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__m), __a)) )
+      : _Safe(std::move(__m), __a),
+	_Base(std::move(__m), __a) { }
 
       multiset(initializer_list<value_type> __l, const allocator_type& __a)
 	: _Base(__l, __a)
@@ -162,7 +162,7 @@  namespace __debug
       multiset&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
diff --git a/libstdc++-v3/include/debug/safe_container.h b/libstdc++-v3/include/debug/safe_container.h
index 5de55d69f34..caba37a1207 100644
--- a/libstdc++-v3/include/debug/safe_container.h
+++ b/libstdc++-v3/include/debug/safe_container.h
@@ -48,10 +48,6 @@  namespace __gnu_debug
       { return *static_cast<_SafeContainer*>(this); }
 
     protected:
-      _Safe_container&
-      _M_safe() _GLIBCXX_NOEXCEPT
-      { return *this; }
-
 #if __cplusplus >= 201103L
       _Safe_container() = default;
       _Safe_container(const _Safe_container&) = default;
diff --git a/libstdc++-v3/include/debug/set.h b/libstdc++-v3/include/debug/set.h
index e35e5c1faae..39142aef60b 100644
--- a/libstdc++-v3/include/debug/set.h
+++ b/libstdc++-v3/include/debug/set.h
@@ -117,9 +117,9 @@  namespace __debug
       : _Base(__x, __a) { }
 
       set(set&& __x, const __type_identity_t<allocator_type>& __a)
-      noexcept( noexcept(_Base(std::move(__x._M_base()), __a)) )
-      : _Safe(std::move(__x._M_safe()), __a),
-	_Base(std::move(__x._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__x), __a)) )
+      : _Safe(std::move(__x), __a),
+	_Base(std::move(__x), __a) { }
 
       set(initializer_list<value_type> __l, const allocator_type& __a)
       : _Base(__l, __a) { }
@@ -160,7 +160,7 @@  namespace __debug
       set&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
diff --git a/libstdc++-v3/include/debug/string b/libstdc++-v3/include/debug/string
index 2209f88fd54..dd16527b958 100644
--- a/libstdc++-v3/include/debug/string
+++ b/libstdc++-v3/include/debug/string
@@ -160,8 +160,8 @@  namespace __gnu_debug
       basic_string(basic_string&& __s, const _Allocator& __a)
       noexcept(
 	std::is_nothrow_constructible<_Base, _Base, const _Allocator&>::value )
-      : _Safe(std::move(__s._M_safe()), __a),
-	_Base(std::move(__s._M_base()), __a)
+      : _Safe(std::move(__s), __a),
+	_Base(std::move(__s), __a)
       { }
 
       ~basic_string() = default;
@@ -213,7 +213,7 @@  namespace __gnu_debug
       operator=(const _CharT* __s)
       {
 	__glibcxx_check_string(__s);
-	_M_base() = __s;
+	_Base::operator=(__s);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -221,7 +221,7 @@  namespace __gnu_debug
       basic_string&
       operator=(_CharT __c)
       {
-	_M_base() = __c;
+	_Base::operator=(__c);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -230,7 +230,7 @@  namespace __gnu_debug
       basic_string&
       operator=(std::initializer_list<_CharT> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -341,7 +341,7 @@  namespace __gnu_debug
 			      ._M_sequence(*this, "this")
 			      ._M_integer(__pos, "__pos")
 			      ._M_integer(this->size(), "size"));
-	return _M_base()[__pos];
+	return _Base::operator[](__pos);
       }
 
       reference
@@ -357,7 +357,7 @@  namespace __gnu_debug
 			      ._M_integer(__pos, "__pos")
 			      ._M_integer(this->size(), "size"));
 #endif
-	return _M_base()[__pos];
+	return _Base::operator[](__pos);
       }
 
       using _Base::at;
@@ -371,7 +371,7 @@  namespace __gnu_debug
       basic_string&
       operator+=(const basic_string& __str)
       {
-	_M_base() += __str;
+	_Base::operator+=(__str);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -380,7 +380,7 @@  namespace __gnu_debug
       operator+=(const _CharT* __s)
       {
 	__glibcxx_check_string(__s);
-	_M_base() += __s;
+	_Base::operator+=(__s);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -388,7 +388,7 @@  namespace __gnu_debug
       basic_string&
       operator+=(_CharT __c)
       {
-	_M_base() += __c;
+	_Base::operator+=(__c);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -397,7 +397,7 @@  namespace __gnu_debug
       basic_string&
       operator+=(std::initializer_list<_CharT> __l)
       {
-	_M_base() += __l;
+	_Base::operator+=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map
index d6e184a2e99..64cc8bacabd 100644
--- a/libstdc++-v3/include/debug/unordered_map
+++ b/libstdc++-v3/include/debug/unordered_map
@@ -150,9 +150,9 @@  namespace __debug
 
       unordered_map(unordered_map&& __umap,
 		    const allocator_type& __a)
-      noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) )
-      : _Safe(std::move(__umap._M_safe()), __a),
-	_Base(std::move(__umap._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__umap), __a)) )
+      : _Safe(std::move(__umap), __a),
+	_Base(std::move(__umap), __a) { }
 
       unordered_map(initializer_list<value_type> __l,
 		    size_type __n = 0,
@@ -210,7 +210,7 @@  namespace __debug
       unordered_map&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -561,7 +561,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_uc_guard(std::__detail::_Select1st{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
@@ -575,7 +575,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_umc_guard(std::__detail::_Select1st{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
@@ -953,9 +953,9 @@  namespace __debug
 
       unordered_multimap(unordered_multimap&& __umap,
 			 const allocator_type& __a)
-      noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) )
-      : _Safe(std::move(__umap._M_safe()), __a),
-	_Base(std::move(__umap._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__umap), __a)) )
+      : _Safe(std::move(__umap), __a),
+	_Base(std::move(__umap), __a) { }
 
       unordered_multimap(initializer_list<value_type> __l,
 			 size_type __n = 0,
@@ -1010,7 +1010,7 @@  namespace __debug
       unordered_multimap&
       operator=(initializer_list<value_type> __l)
       {
-	this->_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -1270,7 +1270,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_umc_guard(std::__detail::_Select1st{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
@@ -1284,7 +1284,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_uc_guard(std::__detail::_Select1st{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set
index 7dc91fa862d..3516af4dc4e 100644
--- a/libstdc++-v3/include/debug/unordered_set
+++ b/libstdc++-v3/include/debug/unordered_set
@@ -146,9 +146,9 @@  namespace __debug
 
       unordered_set(unordered_set&& __uset,
 		    const allocator_type& __a)
-      noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) )
-      : _Safe(std::move(__uset._M_safe()), __a),
-	_Base(std::move(__uset._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__uset), __a)) )
+      : _Safe(std::move(__uset), __a),
+	_Base(std::move(__uset), __a) { }
 
       unordered_set(initializer_list<value_type> __l,
 		    size_type __n = 0,
@@ -203,7 +203,7 @@  namespace __debug
       unordered_set&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -448,7 +448,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_uc_guard(std::__detail::_Identity{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
@@ -462,7 +462,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_umc_guard(std::__detail::_Identity{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
@@ -819,9 +819,9 @@  namespace __debug
 
       unordered_multiset(unordered_multiset&& __uset,
 			 const allocator_type& __a)
-      noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) )
-      : _Safe(std::move(__uset._M_safe()), __a),
-	_Base(std::move(__uset._M_base()), __a) { }
+      noexcept( noexcept(_Base(std::move(__uset), __a)) )
+      : _Safe(std::move(__uset), __a),
+	_Base(std::move(__uset), __a) { }
 
       unordered_multiset(initializer_list<value_type> __l,
 			 size_type __n = 0,
@@ -876,7 +876,7 @@  namespace __debug
       unordered_multiset&
       operator=(initializer_list<value_type> __l)
       {
-	this->_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	return *this;
       }
@@ -1116,7 +1116,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_umc_guard(std::__detail::_Identity{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
@@ -1130,7 +1130,7 @@  namespace __debug
 	{
 	  auto __guard
 	    = _Safe::_S_uc_guard(std::__detail::_Identity{}, __source);
-	  _Base::merge(__source._M_base());
+	  _Base::merge(__source);
 	}
 
       template<typename _H2, typename _P2>
diff --git a/libstdc++-v3/include/debug/vector b/libstdc++-v3/include/debug/vector
index b532a168e0e..ed10e82c080 100644
--- a/libstdc++-v3/include/debug/vector
+++ b/libstdc++-v3/include/debug/vector
@@ -219,8 +219,8 @@  namespace __debug
       noexcept(
 	std::is_nothrow_constructible<_Base,
 	  _Base, const allocator_type&>::value )
-      : _Safe(std::move(__x._M_safe()), __a),
-	_Base(std::move(__x._M_base()), __a),
+      : _Safe(std::move(__x), __a),
+	_Base(std::move(__x), __a),
 	_Safe_vector(std::move(__x)) { }
 
       vector(initializer_list<value_type> __l,
@@ -244,7 +244,7 @@  namespace __debug
       vector&
       operator=(initializer_list<value_type> __l)
       {
-	_M_base() = __l;
+	_Base::operator=(__l);
 	this->_M_invalidate_all();
 	this->_M_update_guaranteed_capacity();
 	return *this;
@@ -440,7 +440,7 @@  namespace __debug
       operator[](size_type __n) _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_subscript(__n);
-	return _M_base()[__n];
+	return _Base::operator[](__n);
       }
 
       _GLIBCXX_NODISCARD
@@ -448,7 +448,7 @@  namespace __debug
       operator[](size_type __n) const _GLIBCXX_NOEXCEPT
       {
 	__glibcxx_check_subscript(__n);
-	return _M_base()[__n];
+	return _Base::operator[](__n);
       }
 
       using _Base::at;