Commit 5d045324 by François Dumont

bitset (bitset::reference::reference(const _Base_ref&, bitset*)): Remove __unused__ attribute.

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