aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-25 20:15:21 +0000
committerfdumont <fdumont@138bc75d-0d04-0410-961f-82ee72b054a4>2016-09-25 20:15:21 +0000
commitc7825a47f0733e516ae1c9d5583ff78af9da3733 (patch)
tree843dd350c0abcd09023435300c5b50c29460b8a1
parent40e245e193b39f65908294f259619e593f53dcd6 (diff)
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@240478 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--libstdc++-v3/ChangeLog31
-rw-r--r--libstdc++-v3/include/debug/bitset15
-rw-r--r--libstdc++-v3/include/debug/safe_base.h13
-rw-r--r--libstdc++-v3/include/debug/safe_container.h7
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.h2
-rw-r--r--libstdc++-v3/include/debug/safe_iterator.tcc1
-rw-r--r--libstdc++-v3/include/debug/safe_unordered_base.h17
7 files changed, 63 insertions, 23 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 83b3aa8e621..47a52b52656 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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.
diff --git a/libstdc++-v3/include/debug/bitset b/libstdc++-v3/include/debug/bitset
index 55d3281ee3d..b7bada30cf8 100644
--- a/libstdc++-v3/include/debug/bitset
+++ b/libstdc++-v3/include/debug/bitset
@@ -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();
diff --git a/libstdc++-v3/include/debug/safe_base.h b/libstdc++-v3/include/debug/safe_base.h
index ede65fd88d3..78c3ffdd4d0 100644
--- a/libstdc++-v3/include/debug/safe_base.h
+++ b/libstdc++-v3/include/debug/safe_base.h
@@ -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);
diff --git a/libstdc++-v3/include/debug/safe_container.h b/libstdc++-v3/include/debug/safe_container.h
index b73f68c62a5..d96cb17a2a3 100644
--- a/libstdc++-v3/include/debug/safe_container.h
+++ b/libstdc++-v3/include/debug/safe_container.h
@@ -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)
diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h
index 03c02638a13..d550ac240e1 100644
--- a/libstdc++-v3/include/debug/safe_iterator.h
+++ b/libstdc++-v3/include/debug/safe_iterator.h
@@ -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;
}
diff --git a/libstdc++-v3/include/debug/safe_iterator.tcc b/libstdc++-v3/include/debug/safe_iterator.tcc
index e8e1b00fe20..0ae7fd1571b 100644
--- a/libstdc++-v3/include/debug/safe_iterator.tcc
+++ b/libstdc++-v3/include/debug/safe_iterator.tcc
@@ -93,4 +93,3 @@ namespace __gnu_debug
} // namespace __gnu_debug
#endif
-
diff --git a/libstdc++-v3/include/debug/safe_unordered_base.h b/libstdc++-v3/include/debug/safe_unordered_base.h
index 82a42eb3c99..21292c33e34 100644
--- a/libstdc++-v3/include/debug/safe_unordered_base.h
+++ b/libstdc++-v3/include/debug/safe_unordered_base.h
@@ -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);