+2013-09-18 Marc Glisse <marc.glisse@inria.fr>
+
+ PR libstdc++/58338
+ * include/bits/list.tcc (_List_base::_M_clear, list::erase): Mark as
+ noexcept.
+ * include/bits/stl_list.h (_List_iterator) [_List_iterator,
+ _M_const_cast, operator*, operator->, operator++, operator--,
+ operator==, operator!=]: Likewise.
+ (_List_const_iterator) [_List_const_iterator, _M_const_cast, operator*,
+ operator->, operator++, operator--, operator==, operator!=]: Likewise.
+ (operator==(const _List_iterator&, const _List_const_iterator&),
+ operator!=(const _List_iterator&, const _List_const_iterator&)):
+ Likewise.
+ (_List_impl) [_List_impl(const _Node_alloc_type&),
+ _List_impl(_Node_alloc_type&&)]: Likewise.
+ (_List_base) [_M_put_node, _List_base(const _Node_alloc_type&),
+ _List_base(_List_base&&), _M_clear, _M_init]: Likewise.
+ (list) [list(), list(const allocator_type&)]: Merge.
+ (list) [list(const allocator_type&), front, back, pop_front, pop_back,
+ erase, _M_erase]: Mark as noexcept.
+ * include/debug/list (list) [list(const _Allocator&), front, back,
+ pop_front, pop_back, _M_erase, erase]: Likewise.
+ * include/profile/list (list) [list(const _Allocator&), front, back,
+ pop_front, pop_back, erase]: Likewise.
+ * testsuite/23_containers/list/requirements/dr438/assign_neg.cc:
+ Adjust line number.
+ * testsuite/23_containers/list/requirements/dr438/constructor_1_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/constructor_2_neg.cc:
+ Likewise.
+ * testsuite/23_containers/list/requirements/dr438/insert_neg.cc:
+ Likewise.
+
2013-09-17 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/58338
typedef _Tp* pointer;
typedef _Tp& reference;
- _List_iterator()
+ _List_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
explicit
- _List_iterator(__detail::_List_node_base* __x)
+ _List_iterator(__detail::_List_node_base* __x) _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
_Self
- _M_const_cast() const
+ _M_const_cast() const _GLIBCXX_NOEXCEPT
{ return *this; }
// Must downcast from _List_node_base to _List_node to get to _M_data.
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Node*>(_M_node)->_M_data; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_next;
return *this;
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_next;
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_prev;
return *this;
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_prev;
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node != __x._M_node; }
// The only member points to the %list element.
typedef const _Tp* pointer;
typedef const _Tp& reference;
- _List_const_iterator()
+ _List_const_iterator() _GLIBCXX_NOEXCEPT
: _M_node() { }
explicit
_List_const_iterator(const __detail::_List_node_base* __x)
+ _GLIBCXX_NOEXCEPT
: _M_node(__x) { }
- _List_const_iterator(const iterator& __x)
+ _List_const_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
: _M_node(__x._M_node) { }
iterator
- _M_const_cast() const
+ _M_const_cast() const _GLIBCXX_NOEXCEPT
{ return iterator(const_cast<__detail::_List_node_base*>(_M_node)); }
// Must downcast from List_node_base to _List_node to get to
// _M_data.
reference
- operator*() const
+ operator*() const _GLIBCXX_NOEXCEPT
{ return static_cast<_Node*>(_M_node)->_M_data; }
pointer
- operator->() const
+ operator->() const _GLIBCXX_NOEXCEPT
{ return std::__addressof(static_cast<_Node*>(_M_node)->_M_data); }
_Self&
- operator++()
+ operator++() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_next;
return *this;
}
_Self
- operator++(int)
+ operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_next;
}
_Self&
- operator--()
+ operator--() _GLIBCXX_NOEXCEPT
{
_M_node = _M_node->_M_prev;
return *this;
}
_Self
- operator--(int)
+ operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
_M_node = _M_node->_M_prev;
}
bool
- operator==(const _Self& __x) const
+ operator==(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node == __x._M_node; }
bool
- operator!=(const _Self& __x) const
+ operator!=(const _Self& __x) const _GLIBCXX_NOEXCEPT
{ return _M_node != __x._M_node; }
// The only member points to the %list element.
template<typename _Val>
inline bool
operator==(const _List_iterator<_Val>& __x,
- const _List_const_iterator<_Val>& __y)
+ const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node == __y._M_node; }
template<typename _Val>
inline bool
operator!=(const _List_iterator<_Val>& __x,
- const _List_const_iterator<_Val>& __y)
+ const _List_const_iterator<_Val>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_node != __y._M_node; }
: _Node_alloc_type(), _M_node()
{ }
- _List_impl(const _Node_alloc_type& __a)
+ _List_impl(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _Node_alloc_type(__a), _M_node()
{ }
#if __cplusplus >= 201103L
- _List_impl(_Node_alloc_type&& __a)
+ _List_impl(_Node_alloc_type&& __a) _GLIBCXX_NOEXCEPT
: _Node_alloc_type(std::move(__a)), _M_node()
{ }
#endif
{ return _M_impl._Node_alloc_type::allocate(1); }
void
- _M_put_node(_List_node<_Tp>* __p)
+ _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
{ _M_impl._Node_alloc_type::deallocate(__p, 1); }
public:
: _M_impl()
{ _M_init(); }
- _List_base(const _Node_alloc_type& __a)
+ _List_base(const _Node_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _M_impl(__a)
{ _M_init(); }
#if __cplusplus >= 201103L
- _List_base(_List_base&& __x)
+ _List_base(_List_base&& __x) noexcept
: _M_impl(std::move(__x._M_get_Node_allocator()))
{
_M_init();
{ _M_clear(); }
void
- _M_clear();
+ _M_clear() _GLIBCXX_NOEXCEPT;
void
- _M_init()
+ _M_init() _GLIBCXX_NOEXCEPT
{
this->_M_impl._M_node._M_next = &this->_M_impl._M_node;
this->_M_impl._M_node._M_prev = &this->_M_impl._M_node;
public:
// [23.2.2.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
- /**
- * @brief Default constructor creates no elements.
- */
- list()
- : _Base() { }
-
/**
* @brief Creates a %list with no elements.
* @param __a An allocator object.
*/
explicit
- list(const allocator_type& __a)
+ list(const allocator_type& __a = allocator_type()) _GLIBCXX_NOEXCEPT
: _Base(_Node_alloc_type(__a)) { }
#if __cplusplus >= 201103L
* element of the %list.
*/
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
* element of the %list.
*/
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
* of the %list.
*/
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
iterator __tmp = end();
--__tmp;
* element of the %list.
*/
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
const_iterator __tmp = end();
--__tmp;
* called.
*/
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{ this->_M_erase(begin()); }
/**
* is needed, it should be retrieved before pop_back() is called.
*/
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{ this->_M_erase(iterator(this->_M_impl._M_node._M_prev)); }
#if __cplusplus >= 201103L
*/
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position);
+ erase(const_iterator __position) noexcept;
#else
erase(iterator __position);
#endif
*/
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __first, const_iterator __last)
+ erase(const_iterator __first, const_iterator __last) noexcept
#else
erase(iterator __first, iterator __last)
#endif
// Erases element at position given.
void
- _M_erase(iterator __position)
+ _M_erase(iterator __position) _GLIBCXX_NOEXCEPT
{
__position._M_node->_M_unhook();
_Node* __n = static_cast<_Node*>(__position._M_node);
// 23.2.2.1 construct/copy/destroy:
explicit
- list(const _Allocator& __a = _Allocator())
+ list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
// element access:
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::front();
}
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
return _Base::back();
#endif
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(_Base::begin()));
#endif
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(--_Base::end()));
private:
_Base_iterator
#if __cplusplus >= 201103L
- _M_erase(_Base_const_iterator __position)
+ _M_erase(_Base_const_iterator __position) noexcept
#else
_M_erase(_Base_iterator __position)
#endif
public:
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position)
+ erase(const_iterator __position) noexcept
#else
erase(iterator __position)
#endif
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __first, const_iterator __last)
+ erase(const_iterator __first, const_iterator __last) noexcept
#else
erase(iterator __first, iterator __last)
#endif
// 23.2.2.1 construct/copy/destroy:
explicit
- list(const _Allocator& __a = _Allocator())
+ list(const _Allocator& __a = _Allocator()) _GLIBCXX_NOEXCEPT
: _Base(__a)
{
__profcxx_list_construct(this); // list2slist
// element access:
reference
- front()
+ front() _GLIBCXX_NOEXCEPT
{ return _Base::front(); }
const_reference
- front() const
+ front() const _GLIBCXX_NOEXCEPT
{ return _Base::front(); }
reference
- back()
+ back() _GLIBCXX_NOEXCEPT
{
__profcxx_list_rewind(this);
return _Base::back();
}
const_reference
- back() const
+ back() const _GLIBCXX_NOEXCEPT
{
__profcxx_list_rewind(this);
return _Base::back();
#endif
void
- pop_front()
+ pop_front() _GLIBCXX_NOEXCEPT
{
__profcxx_list_operation(this);
_Base::pop_front();
#endif
void
- pop_back()
+ pop_back() _GLIBCXX_NOEXCEPT
{
iterator __victim = end();
--__victim;
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position)
+ erase(const_iterator __position) noexcept
#else
erase(iterator __position)
#endif
iterator
#if __cplusplus >= 201103L
- erase(const_iterator __position, const_iterator __last)
+ erase(const_iterator __position, const_iterator __last) noexcept
#else
erase(iterator __position, iterator __last)
#endif