bitset (bitset::reference::reference(const _Base_ref&, bitset*)): Remove __unused__...
authorFrançois Dumont <fdumont@gcc.gnu.org>
Sun, 25 Sep 2016 20:15:21 +0000 (20:15 +0000)
committerFrançois Dumont <fdumont@gcc.gnu.org>
Sun, 25 Sep 2016 20:15:21 +0000 (20:15 +0000)
2016-09-25  François Dumont  <fdumont@gcc.gnu.org>

* include/debug/bitset (bitset::reference::reference(const _Base_ref&,
bitset*)): Remove __unused__ attribute.
* include/debug/safe_base.h (_Safe_iterator_base): Make
_Safe_sequence_base a friend.
(_Safe_iterator_base::_M_attach): Make protected.
(_Safe_iterator_base::_M_attach_single): Likewise.
(_Safe_iterator_base::_M_detach): Likewise.
(_Safe_iterator_base::_M_detach_single): Likewise.
(_Safe_sequence_base): Make _Safe_iterator_base a friend.
(_Safe_sequence_base::_Safe_sequence_base(_Safe_sequence_base&&)): New.
(_Safe_sequence_base::_M_swap): Make protected.
(_Safe_sequence_base::_M_attach): Make private.
(_Safe_sequence_base::_M_attach_single): Likewise.
(_Safe_sequence_base::_M_detach): Likewise.
(_Safe_sequence_base::_M_detach_single): Likewise.
* include/debug/safe_container.h
(_Safe_container::_Safe_container(_Safe_container&&)): Make default.
* include/debug/safe_iterator.h
(_Safe_iterator::operator++()): Name __scoped_lock instance.
* include/debug/safe_iterator.tcc: Remove trailing line.
* include/debug/safe_unordered_base.h
(_Safe_local_iterator_base::_M_attach): Make protected.
(_Safe_local_iterator_base::_M_attach_single): Likewise.
(_Safe_local_iterator_base::_M_detach): Likewise.
(_Safe_local_iterator_base::_M_detach_single): Likewise.
(_Safe_unordered_container_base): Make _Safe_local_iterator_base friend.
(_Safe_unordered_container_base::_M_attach_local): Make private.
(_Safe_unordered_container_base::_M_attach_local_single): Likewise.
(_Safe_unordered_container_base::_M_detach_local): Likewise.
(_Safe_unordered_container_base::_M_detach_local_single): Likewise.

From-SVN: r240478

libstdc++-v3/ChangeLog
libstdc++-v3/include/debug/bitset
libstdc++-v3/include/debug/safe_base.h
libstdc++-v3/include/debug/safe_container.h
libstdc++-v3/include/debug/safe_iterator.h
libstdc++-v3/include/debug/safe_iterator.tcc
libstdc++-v3/include/debug/safe_unordered_base.h

index 83b3aa8e62164e0ec69c1ac089bd2ce335710506..47a52b52656892e19b7965352af4f71918abafa7 100644 (file)
@@ -1,5 +1,36 @@
 2016-09-25  François Dumont  <fdumont@gcc.gnu.org>
 
+       * include/debug/bitset (bitset::reference::reference(const _Base_ref&,
+       bitset*)): Remove __unused__ attribute.
+       * include/debug/safe_base.h (_Safe_iterator_base): Make
+       _Safe_sequence_base a friend.
+       (_Safe_iterator_base::_M_attach): Make protected.
+       (_Safe_iterator_base::_M_attach_single): Likewise.
+       (_Safe_iterator_base::_M_detach): Likewise.
+       (_Safe_iterator_base::_M_detach_single): Likewise.
+       (_Safe_sequence_base): Make _Safe_iterator_base a friend.
+       (_Safe_sequence_base::_Safe_sequence_base(_Safe_sequence_base&&)): New.
+       (_Safe_sequence_base::_M_swap): Make protected.
+       (_Safe_sequence_base::_M_attach): Make private.
+       (_Safe_sequence_base::_M_attach_single): Likewise.
+       (_Safe_sequence_base::_M_detach): Likewise.
+       (_Safe_sequence_base::_M_detach_single): Likewise.
+       * include/debug/safe_container.h
+       (_Safe_container::_Safe_container(_Safe_container&&)): Make default.
+       * include/debug/safe_iterator.h
+       (_Safe_iterator::operator++()): Name __scoped_lock instance.
+       * include/debug/safe_iterator.tcc: Remove trailing line.
+       * include/debug/safe_unordered_base.h
+       (_Safe_local_iterator_base::_M_attach): Make protected.
+       (_Safe_local_iterator_base::_M_attach_single): Likewise.
+       (_Safe_local_iterator_base::_M_detach): Likewise.
+       (_Safe_local_iterator_base::_M_detach_single): Likewise.
+       (_Safe_unordered_container_base): Make _Safe_local_iterator_base friend.
+       (_Safe_unordered_container_base::_M_attach_local): Make private.
+       (_Safe_unordered_container_base::_M_attach_local_single): Likewise.
+       (_Safe_unordered_container_base::_M_detach_local): Likewise.
+       (_Safe_unordered_container_base::_M_detach_local_single): Likewise.
+
        * include/parallel/algo.h: Generalize usage of std::__iterator_category.
        Adjust whitespaces.
 
index 55d3281ee3d06159d7fc390bee2f42cff2f1afa1..b7bada30cf88abddca7116399bc189b6ef0b9f0a 100644 (file)
@@ -66,8 +66,7 @@ namespace __debug
        friend class bitset;
        reference();
 
-       reference(const _Base_ref& __base,
-                 bitset* __seq __attribute__((__unused__))) _GLIBCXX_NOEXCEPT
+       reference(const _Base_ref& __base, bitset* __seq) _GLIBCXX_NOEXCEPT
        : _Base_ref(__base)
        , _Safe_iterator_base(__seq, false)
        { }
@@ -81,7 +80,7 @@ namespace __debug
        reference&
        operator=(bool __x) _GLIBCXX_NOEXCEPT
        {
-         _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+         _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(),
                              _M_message(__gnu_debug::__msg_bad_bitset_write)
                                ._M_iterator(*this));
          *static_cast<_Base_ref*>(this) = __x;
@@ -91,10 +90,10 @@ namespace __debug
        reference&
        operator=(const reference& __x) _GLIBCXX_NOEXCEPT
        {
-         _GLIBCXX_DEBUG_VERIFY(! __x._M_singular(),
+         _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(),
                               _M_message(__gnu_debug::__msg_bad_bitset_read)
                                ._M_iterator(__x));
-         _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+         _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(),
                              _M_message(__gnu_debug::__msg_bad_bitset_write)
                                ._M_iterator(*this));
          *static_cast<_Base_ref*>(this) = __x;
@@ -104,7 +103,7 @@ namespace __debug
        bool
        operator~() const _GLIBCXX_NOEXCEPT
        {
-         _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+         _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(),
                               _M_message(__gnu_debug::__msg_bad_bitset_read)
                                ._M_iterator(*this));
          return ~(*static_cast<const _Base_ref*>(this));
@@ -112,7 +111,7 @@ namespace __debug
 
        operator bool() const _GLIBCXX_NOEXCEPT
        {
-         _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+         _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(),
                              _M_message(__gnu_debug::__msg_bad_bitset_read)
                                ._M_iterator(*this));
          return *static_cast<const _Base_ref*>(this);
@@ -121,7 +120,7 @@ namespace __debug
        reference&
        flip() _GLIBCXX_NOEXCEPT
        {
-         _GLIBCXX_DEBUG_VERIFY(! this->_M_singular(),
+         _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(),
                              _M_message(__gnu_debug::__msg_bad_bitset_flip)
                                ._M_iterator(*this));
          _Base_ref::flip();
index ede65fd88d323659cc5f4e2ee73d03c6bdcbc185..78c3ffdd4d0e6a36c5b6df22b7dcb4d11638fe0b 100644 (file)
@@ -49,6 +49,8 @@ namespace __gnu_debug
    */
   class _Safe_iterator_base
   {
+    friend class _Safe_sequence_base;
+
   public:
     /** The sequence this iterator references; may be NULL to indicate
        a singular iterator. */
@@ -101,7 +103,6 @@ namespace __gnu_debug
     __gnu_cxx::__mutex&
     _M_get_mutex() throw ();
 
-  public:
     /** Attaches this iterator to the given sequence, detaching it
      * from whatever sequence it was attached to originally. If the
      * new sequence is the NULL pointer, the iterator is left
@@ -124,6 +125,7 @@ namespace __gnu_debug
     void
     _M_detach_single() throw ();
 
+  public:
     /** Determines if we are attached to the given sequence. */
     bool
     _M_attached_to(const _Safe_sequence_base* __seq) const
@@ -185,6 +187,8 @@ namespace __gnu_debug
    */
   class _Safe_sequence_base
   {
+    friend class _Safe_iterator_base;
+
   public:
     /// The list of mutable iterators that reference this container
     _Safe_iterator_base* _M_iterators;
@@ -204,6 +208,11 @@ namespace __gnu_debug
 #if __cplusplus >= 201103L
     _Safe_sequence_base(const _Safe_sequence_base&) noexcept
     : _Safe_sequence_base() { }
+
+    // Move constructor swap iterators.
+    _Safe_sequence_base(_Safe_sequence_base&& __seq) noexcept
+    : _Safe_sequence_base()
+    { _M_swap(__seq); }
 #endif
 
     /** Notify all iterators that reference this sequence that the
@@ -242,12 +251,12 @@ namespace __gnu_debug
     __gnu_cxx::__mutex&
     _M_get_mutex() throw ();
 
-  public:
     /** Invalidates all iterators. */
     void
     _M_invalidate_all() const
     { if (++_M_version == 0) _M_version = 1; }
 
+  private:
     /** Attach an iterator to this sequence. */
     void
     _M_attach(_Safe_iterator_base* __it, bool __constant);
index b73f68c62a5710ad79abd164e44c9281024d9b82..d96cb17a2a3ec9ccff3606e5ec7b75b967858502 100644 (file)
@@ -55,12 +55,9 @@ namespace __gnu_debug
 #if __cplusplus >= 201103L
       _Safe_container() = default;
       _Safe_container(const _Safe_container&) = default;
-      _Safe_container(_Safe_container&& __x) noexcept
-      : _Safe_container()
-      { _Base::_M_swap(__x); }
+      _Safe_container(_Safe_container&&) = default;
 
-      _Safe_container(_Safe_container&& __x,
-                     const _Alloc& __a)
+      _Safe_container(_Safe_container&& __x, const _Alloc& __a)
       : _Safe_container()
       {
        if (__x._M_cont().get_allocator() == __a)
index 03c02638a13593ea09fadeffbb57c77003f16659..d550ac240e1e60fc8972584384d669fb40c5124a 100644 (file)
@@ -295,7 +295,7 @@ namespace __gnu_debug
        _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
                              _M_message(__msg_bad_inc)
                              ._M_iterator(*this, "this"));
-       __gnu_cxx::__scoped_lock(this->_M_get_mutex());
+       __gnu_cxx::__scoped_lock __l(this->_M_get_mutex());
        ++base();
        return *this;
       }
index e8e1b00fe204737a9a60d7767bde8fce5adec565..0ae7fd1571bea346cba4cb04f7243699f5531f3a 100644 (file)
@@ -93,4 +93,3 @@ namespace __gnu_debug
 } // namespace __gnu_debug
 
 #endif
-
index 82a42eb3c99c4500dfe8e45075ba0fe39809d5c5..21292c33e3400b809366393f2123319a2125d797 100644 (file)
@@ -76,24 +76,27 @@ namespace __gnu_debug
     _Safe_unordered_container_base*
     _M_get_container() const noexcept;
 
-  public:
     /** Attaches this iterator to the given container, detaching it
      * from whatever container it was attached to originally. If the
      * new container is the NULL pointer, the iterator is left
      * unattached.
      */
-    void _M_attach(_Safe_sequence_base* __seq, bool __constant);
+    void
+    _M_attach(_Safe_sequence_base* __seq, bool __constant);
 
     /** Likewise, but not thread-safe. */
-    void _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ();
+    void
+    _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw ();
 
     /** Detach the iterator for whatever container it is attached to,
      * if any.
     */
-    void _M_detach();
+    void
+    _M_detach();
 
     /** Likewise, but not thread-safe. */
-    void _M_detach_single() throw ();
+    void
+    _M_detach_single() throw ();
   };
 
   /**
@@ -116,7 +119,9 @@ namespace __gnu_debug
    */
   class _Safe_unordered_container_base : public _Safe_sequence_base
   {
+    friend class _Safe_local_iterator_base;
     typedef _Safe_sequence_base _Base;
+
   public:
     /// The list of mutable local iterators that reference this container
     _Safe_iterator_base* _M_local_iterators;
@@ -158,7 +163,7 @@ namespace __gnu_debug
     void
     _M_swap(_Safe_unordered_container_base& __x) noexcept;
 
-  public:
+  private:
     /** Attach an iterator to this container. */
     void
     _M_attach_local(_Safe_iterator_base* __it, bool __constant);