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
This commit is contained in:
François Dumont 2016-09-25 20:15:21 +00:00
parent 9b597c1f41
commit 5d04532430
7 changed files with 63 additions and 23 deletions

View 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.

View 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();

View 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);

View 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)

View 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;
}

View file

@ -93,4 +93,3 @@ namespace __gnu_debug
} // namespace __gnu_debug
#endif

View 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);