Commit d15ac9d9 by Marc Glisse Committed by Marc Glisse

re PR libstdc++/58338 (Add noexcept to functions with a narrow contract)

2013-09-20  Marc Glisse  <marc.glisse@inria.fr>

	PR libstdc++/58338
	* include/bits/allocator.h (__alloc_swap::_S_do_it,
	__shrink_to_fit_aux::_S_do_it): Mark as noexcept.
	* include/bits/basic_string.h (basic_string::_Rep) [_S_empty_rep,
	_M_is_leaked, _M_is_shared, _M_set_leaked, _M_set_sharable,
	_M_set_length_and_sharable, _M_dispose]: Likewise.
	(basic_string::_Alloc_hider::_Alloc_hider): Likewise.
	(basic_string) [_M_data, _M_rep, _M_ibegin, _M_iend, _M_limit,
	_M_disjunct, _M_copy, _M_move, _M_assign, _S_copy_chars, _S_compare,
	_S_empty_rep, shrink_to_fit, operator[] const, front const, back const]:
	Likewise.
	[clear]: Link to PR 56166.
	[swap]: Link to PR 58265.
	* include/bits/stl_deque.h (_Deque_iterator) [_S_buffer_size,
	_Deque_iterator, _M_const_cast, operator*, operator->, operator++,
	operator--, operator+=, operator+, operator-=, operator-, operator[],
	_M_set_node]: Mark as noexcept.
	(operator==(const _Deque_iterator&, const _Deque_iterator&),
	operator!=(const _Deque_iterator&, const _Deque_iterator&),
	operator<(const _Deque_iterator&, const _Deque_iterator&),
	operator>(const _Deque_iterator&, const _Deque_iterator&),
	operator<=(const _Deque_iterator&, const _Deque_iterator&),
	operator>=(const _Deque_iterator&, const _Deque_iterator&),
	operator-(const _Deque_iterator&, const _Deque_iterator&),
	operator+(ptrdiff_t, const _Deque_iterator&)): Likewise.
	(_Deque_base) [_Deque_base(const allocator_type&)]: Add missing call to
	_M_initialize_map.
	[~_Deque_base, _M_deallocate_node, _M_deallocate_map, _M_destroy_nodes]:
	Mark as noexcept.
	(_Deque_base::_Deque_impl) [_Deque_impl(const _Tp_alloc_type&),
	_Deque_impl(_Tp_alloc_type&&)]: Likewise.
	(deque) [_S_buffer_size, operator=(deque&&), shrink_to_fit, operator[],
	front, back, pop_front, pop_back, swap]: Likewise.
	[deque(), deque(const allocator_type&)]: Merge.
	* include/debug/deque (deque) [operator=(deque&&), shrink_to_fit,
	operator[], front, back, pop_front, pop_back, swap]: Mark as noexcept.
	* include/profile/deque (deque) [operator=(deque&&), operator[], front,
	back, pop_front, pop_back, swap]: Likewise.
	* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
	Adjust line number.
	* testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
	Likewise.
	* testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
	Likewise.
	* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
	Likewise.

From-SVN: r202781
parent d20e48b0
2013-09-20 Marc Glisse <marc.glisse@inria.fr>
PR libstdc++/58338
* include/bits/allocator.h (__alloc_swap::_S_do_it,
__shrink_to_fit_aux::_S_do_it): Mark as noexcept.
* include/bits/basic_string.h (basic_string::_Rep) [_S_empty_rep,
_M_is_leaked, _M_is_shared, _M_set_leaked, _M_set_sharable,
_M_set_length_and_sharable, _M_dispose]: Likewise.
(basic_string::_Alloc_hider::_Alloc_hider): Likewise.
(basic_string) [_M_data, _M_rep, _M_ibegin, _M_iend, _M_limit,
_M_disjunct, _M_copy, _M_move, _M_assign, _S_copy_chars, _S_compare,
_S_empty_rep, shrink_to_fit, operator[] const, front const, back const]:
Likewise.
[clear]: Link to PR 56166.
[swap]: Link to PR 58265.
* include/bits/stl_deque.h (_Deque_iterator) [_S_buffer_size,
_Deque_iterator, _M_const_cast, operator*, operator->, operator++,
operator--, operator+=, operator+, operator-=, operator-, operator[],
_M_set_node]: Mark as noexcept.
(operator==(const _Deque_iterator&, const _Deque_iterator&),
operator!=(const _Deque_iterator&, const _Deque_iterator&),
operator<(const _Deque_iterator&, const _Deque_iterator&),
operator>(const _Deque_iterator&, const _Deque_iterator&),
operator<=(const _Deque_iterator&, const _Deque_iterator&),
operator>=(const _Deque_iterator&, const _Deque_iterator&),
operator-(const _Deque_iterator&, const _Deque_iterator&),
operator+(ptrdiff_t, const _Deque_iterator&)): Likewise.
(_Deque_base) [_Deque_base(const allocator_type&)]: Add missing call to
_M_initialize_map.
[~_Deque_base, _M_deallocate_node, _M_deallocate_map, _M_destroy_nodes]:
Mark as noexcept.
(_Deque_base::_Deque_impl) [_Deque_impl(const _Tp_alloc_type&),
_Deque_impl(_Tp_alloc_type&&)]: Likewise.
(deque) [_S_buffer_size, operator=(deque&&), shrink_to_fit, operator[],
front, back, pop_front, pop_back, swap]: Likewise.
[deque(), deque(const allocator_type&)]: Merge.
* include/debug/deque (deque) [operator=(deque&&), shrink_to_fit,
operator[], front, back, pop_front, pop_back, swap]: Mark as noexcept.
* include/profile/deque (deque) [operator=(deque&&), operator[], front,
back, pop_front, pop_back, swap]: Likewise.
* testsuite/23_containers/deque/requirements/dr438/assign_neg.cc:
Adjust line number.
* testsuite/23_containers/deque/requirements/dr438/constructor_1_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/constructor_2_neg.cc:
Likewise.
* testsuite/23_containers/deque/requirements/dr438/insert_neg.cc:
Likewise.
2013-09-20 Alan Modra <amodra@gmail.com>
* configure: Regenerate.
......
......@@ -158,13 +158,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// To implement Option 3 of DR 431.
template<typename _Alloc, bool = __is_empty(_Alloc)>
struct __alloc_swap
{ static void _S_do_it(_Alloc&, _Alloc&) { } };
{ static void _S_do_it(_Alloc&, _Alloc&) _GLIBCXX_NOEXCEPT { } };
template<typename _Alloc>
struct __alloc_swap<_Alloc, false>
{
static void
_S_do_it(_Alloc& __one, _Alloc& __two)
_S_do_it(_Alloc& __one, _Alloc& __two) _GLIBCXX_NOEXCEPT
{
// Precondition: swappable allocators.
if (__one != __two)
......@@ -194,13 +194,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
= __or_<is_copy_constructible<typename _Tp::value_type>,
is_nothrow_move_constructible<typename _Tp::value_type>>::value>
struct __shrink_to_fit_aux
{ static bool _S_do_it(_Tp&) { return false; } };
{ static bool _S_do_it(_Tp&) noexcept { return false; } };
template<typename _Tp>
struct __shrink_to_fit_aux<_Tp, true>
{
static bool
_S_do_it(_Tp& __c)
_S_do_it(_Tp& __c) noexcept
{
__try
{
......
......@@ -178,7 +178,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
static size_type _S_empty_rep_storage[];
static _Rep&
_S_empty_rep()
_S_empty_rep() _GLIBCXX_NOEXCEPT
{
// NB: Mild hack to avoid strict-aliasing warnings. Note that
// _S_empty_rep_storage is never modified and the punning should
......@@ -188,23 +188,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
bool
_M_is_leaked() const
_M_is_leaked() const _GLIBCXX_NOEXCEPT
{ return this->_M_refcount < 0; }
bool
_M_is_shared() const
_M_is_shared() const _GLIBCXX_NOEXCEPT
{ return this->_M_refcount > 0; }
void
_M_set_leaked()
_M_set_leaked() _GLIBCXX_NOEXCEPT
{ this->_M_refcount = -1; }
void
_M_set_sharable()
_M_set_sharable() _GLIBCXX_NOEXCEPT
{ this->_M_refcount = 0; }
void
_M_set_length_and_sharable(size_type __n)
_M_set_length_and_sharable(size_type __n) _GLIBCXX_NOEXCEPT
{
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
if (__builtin_expect(this != &_S_empty_rep(), false))
......@@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_S_create(size_type, size_type, const _Alloc&);
void
_M_dispose(const _Alloc& __a)
_M_dispose(const _Alloc& __a) _GLIBCXX_NOEXCEPT
{
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
if (__builtin_expect(this != &_S_empty_rep(), false))
......@@ -271,7 +271,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// Use empty-base optimization: http://www.cantrip.org/emptyopt.html
struct _Alloc_hider : _Alloc
{
_Alloc_hider(_CharT* __dat, const _Alloc& __a)
_Alloc_hider(_CharT* __dat, const _Alloc& __a) _GLIBCXX_NOEXCEPT
: _Alloc(__a), _M_p(__dat) { }
_CharT* _M_p; // The actual data.
......@@ -289,25 +289,25 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
mutable _Alloc_hider _M_dataplus;
_CharT*
_M_data() const
_M_data() const _GLIBCXX_NOEXCEPT
{ return _M_dataplus._M_p; }
_CharT*
_M_data(_CharT* __p)
_M_data(_CharT* __p) _GLIBCXX_NOEXCEPT
{ return (_M_dataplus._M_p = __p); }
_Rep*
_M_rep() const
_M_rep() const _GLIBCXX_NOEXCEPT
{ return &((reinterpret_cast<_Rep*> (_M_data()))[-1]); }
// For the internal use we have functions similar to `begin'/`end'
// but they do not call _M_leak.
iterator
_M_ibegin() const
_M_ibegin() const _GLIBCXX_NOEXCEPT
{ return iterator(_M_data()); }
iterator
_M_iend() const
_M_iend() const _GLIBCXX_NOEXCEPT
{ return iterator(_M_data() + this->size()); }
void
......@@ -334,7 +334,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// NB: _M_limit doesn't check for a bad __pos value.
size_type
_M_limit(size_type __pos, size_type __off) const
_M_limit(size_type __pos, size_type __off) const _GLIBCXX_NOEXCEPT
{
const bool __testoff = __off < this->size() - __pos;
return __testoff ? __off : this->size() - __pos;
......@@ -342,7 +342,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// True if _Rep and source do not overlap.
bool
_M_disjunct(const _CharT* __s) const
_M_disjunct(const _CharT* __s) const _GLIBCXX_NOEXCEPT
{
return (less<const _CharT*>()(__s, _M_data())
|| less<const _CharT*>()(_M_data() + this->size(), __s));
......@@ -351,7 +351,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// When __n = 1 way faster than the general multichar
// traits_type::copy/move/assign.
static void
_M_copy(_CharT* __d, const _CharT* __s, size_type __n)
_M_copy(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
{
if (__n == 1)
traits_type::assign(*__d, *__s);
......@@ -360,7 +360,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
static void
_M_move(_CharT* __d, const _CharT* __s, size_type __n)
_M_move(_CharT* __d, const _CharT* __s, size_type __n) _GLIBCXX_NOEXCEPT
{
if (__n == 1)
traits_type::assign(*__d, *__s);
......@@ -369,7 +369,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
}
static void
_M_assign(_CharT* __d, size_type __n, _CharT __c)
_M_assign(_CharT* __d, size_type __n, _CharT __c) _GLIBCXX_NOEXCEPT
{
if (__n == 1)
traits_type::assign(*__d, __c);
......@@ -382,29 +382,32 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
template<class _Iterator>
static void
_S_copy_chars(_CharT* __p, _Iterator __k1, _Iterator __k2)
_GLIBCXX_NOEXCEPT
{
for (; __k1 != __k2; ++__k1, ++__p)
traits_type::assign(*__p, *__k1); // These types are off.
}
static void
_S_copy_chars(_CharT* __p, iterator __k1, iterator __k2)
_S_copy_chars(_CharT* __p, iterator __k1, iterator __k2) _GLIBCXX_NOEXCEPT
{ _S_copy_chars(__p, __k1.base(), __k2.base()); }
static void
_S_copy_chars(_CharT* __p, const_iterator __k1, const_iterator __k2)
_GLIBCXX_NOEXCEPT
{ _S_copy_chars(__p, __k1.base(), __k2.base()); }
static void
_S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2)
_S_copy_chars(_CharT* __p, _CharT* __k1, _CharT* __k2) _GLIBCXX_NOEXCEPT
{ _M_copy(__p, __k1, __k2 - __k1); }
static void
_S_copy_chars(_CharT* __p, const _CharT* __k1, const _CharT* __k2)
_GLIBCXX_NOEXCEPT
{ _M_copy(__p, __k1, __k2 - __k1); }
static int
_S_compare(size_type __n1, size_type __n2)
_S_compare(size_type __n1, size_type __n2) _GLIBCXX_NOEXCEPT
{
const difference_type __d = difference_type(__n1 - __n2);
......@@ -423,7 +426,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
_M_leak_hard();
static _Rep&
_S_empty_rep()
_S_empty_rep() _GLIBCXX_NOEXCEPT
{ return _Rep::_S_empty_rep(); }
public:
......@@ -756,7 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L
/// A non-binding request to reduce capacity() to size().
void
shrink_to_fit()
shrink_to_fit() _GLIBCXX_NOEXCEPT
{
if (capacity() > size())
{
......@@ -799,6 +802,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* Erases the string, making it empty.
*/
// PR 56166: this should not throw.
void
clear() _GLIBCXX_NOEXCEPT
{ _M_mutate(0, this->size(), 0); }
......@@ -823,7 +827,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* see at().)
*/
const_reference
operator[] (size_type __pos) const
operator[] (size_type __pos) const _GLIBCXX_NOEXCEPT
{
_GLIBCXX_DEBUG_ASSERT(__pos <= size());
return _M_data()[__pos];
......@@ -903,7 +907,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* element of the %string.
*/
const_reference
front() const
front() const _GLIBCXX_NOEXCEPT
{ return operator[](0); }
/**
......@@ -919,7 +923,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* last element of the %string.
*/
const_reference
back() const
back() const _GLIBCXX_NOEXCEPT
{ return operator[](this->size() - 1); }
#endif
......@@ -1787,6 +1791,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
* Exchanges the contents of this string with that of @a __s in constant
* time.
*/
// PR 58265, this should be noexcept.
void
swap(basic_string& __s);
......
......@@ -108,7 +108,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef _Deque_iterator<_Tp, _Tp&, _Tp*> iterator;
typedef _Deque_iterator<_Tp, const _Tp&, const _Tp*> const_iterator;
static size_t _S_buffer_size()
static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT
{ return __deque_buf_size(sizeof(_Tp)); }
typedef std::random_access_iterator_tag iterator_category;
......@@ -125,31 +125,31 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Tp* _M_last;
_Map_pointer _M_node;
_Deque_iterator(_Tp* __x, _Map_pointer __y)
_Deque_iterator(_Tp* __x, _Map_pointer __y) _GLIBCXX_NOEXCEPT
: _M_cur(__x), _M_first(*__y),
_M_last(*__y + _S_buffer_size()), _M_node(__y) { }
_Deque_iterator()
_Deque_iterator() _GLIBCXX_NOEXCEPT
: _M_cur(0), _M_first(0), _M_last(0), _M_node(0) { }
_Deque_iterator(const iterator& __x)
_Deque_iterator(const iterator& __x) _GLIBCXX_NOEXCEPT
: _M_cur(__x._M_cur), _M_first(__x._M_first),
_M_last(__x._M_last), _M_node(__x._M_node) { }
iterator
_M_const_cast() const
_M_const_cast() const _GLIBCXX_NOEXCEPT
{ return iterator(_M_cur, _M_node); }
reference
operator*() const
operator*() const _GLIBCXX_NOEXCEPT
{ return *_M_cur; }
pointer
operator->() const
operator->() const _GLIBCXX_NOEXCEPT
{ return _M_cur; }
_Self&
operator++()
operator++() _GLIBCXX_NOEXCEPT
{
++_M_cur;
if (_M_cur == _M_last)
......@@ -161,7 +161,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self
operator++(int)
operator++(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
++*this;
......@@ -169,7 +169,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self&
operator--()
operator--() _GLIBCXX_NOEXCEPT
{
if (_M_cur == _M_first)
{
......@@ -181,7 +181,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self
operator--(int)
operator--(int) _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
--*this;
......@@ -189,7 +189,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self&
operator+=(difference_type __n)
operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
{
const difference_type __offset = __n + (_M_cur - _M_first);
if (__offset >= 0 && __offset < difference_type(_S_buffer_size()))
......@@ -208,25 +208,25 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
_Self
operator+(difference_type __n) const
operator+(difference_type __n) const _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
return __tmp += __n;
}
_Self&
operator-=(difference_type __n)
operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
{ return *this += -__n; }
_Self
operator-(difference_type __n) const
operator-(difference_type __n) const _GLIBCXX_NOEXCEPT
{
_Self __tmp = *this;
return __tmp -= __n;
}
reference
operator[](difference_type __n) const
operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
{ return *(*this + __n); }
/**
......@@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* immediately afterwards, based on _M_first and _M_last.
*/
void
_M_set_node(_Map_pointer __new_node)
_M_set_node(_Map_pointer __new_node) _GLIBCXX_NOEXCEPT
{
_M_node = __new_node;
_M_first = *__new_node;
......@@ -249,33 +249,33 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator==(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_cur == __y._M_cur; }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator==(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return __x._M_cur == __y._M_cur; }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator!=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x == __y); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator!=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x == __y); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator<(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
: (__x._M_node < __y._M_node); }
......@@ -283,47 +283,47 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typename _RefR, typename _PtrR>
inline bool
operator<(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return (__x._M_node == __y._M_node) ? (__x._M_cur < __y._M_cur)
: (__x._M_node < __y._M_node); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator>(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return __y < __x; }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator>(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return __y < __x; }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator<=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return !(__y < __x); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator<=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return !(__y < __x); }
template<typename _Tp, typename _Ref, typename _Ptr>
inline bool
operator>=(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x < __y); }
template<typename _Tp, typename _RefL, typename _PtrL,
typename _RefR, typename _PtrR>
inline bool
operator>=(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{ return !(__x < __y); }
// _GLIBCXX_RESOLVE_LIB_DEFECTS
......@@ -333,7 +333,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Ref, typename _Ptr>
inline typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type
operator-(const _Deque_iterator<_Tp, _Ref, _Ptr>& __x,
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y)
const _Deque_iterator<_Tp, _Ref, _Ptr>& __y) _GLIBCXX_NOEXCEPT
{
return typename _Deque_iterator<_Tp, _Ref, _Ptr>::difference_type
(_Deque_iterator<_Tp, _Ref, _Ptr>::_S_buffer_size())
......@@ -345,7 +345,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typename _RefR, typename _PtrR>
inline typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
operator-(const _Deque_iterator<_Tp, _RefL, _PtrL>& __x,
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y)
const _Deque_iterator<_Tp, _RefR, _PtrR>& __y) _GLIBCXX_NOEXCEPT
{
return typename _Deque_iterator<_Tp, _RefL, _PtrL>::difference_type
(_Deque_iterator<_Tp, _RefL, _PtrL>::_S_buffer_size())
......@@ -356,6 +356,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Ref, typename _Ptr>
inline _Deque_iterator<_Tp, _Ref, _Ptr>
operator+(ptrdiff_t __n, const _Deque_iterator<_Tp, _Ref, _Ptr>& __x)
_GLIBCXX_NOEXCEPT
{ return __x + __n; }
template<typename _Tp>
......@@ -466,7 +467,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_Deque_base(const allocator_type& __a)
: _M_impl(__a)
{ }
{ _M_initialize_map(0); }
#if __cplusplus >= 201103L
_Deque_base(_Deque_base&& __x)
......@@ -483,7 +484,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
#endif
~_Deque_base();
~_Deque_base() _GLIBCXX_NOEXCEPT;
protected:
//This struct encapsulates the implementation of the std::deque
......@@ -506,13 +507,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_M_start(), _M_finish()
{ }
_Deque_impl(const _Tp_alloc_type& __a)
_Deque_impl(const _Tp_alloc_type& __a) _GLIBCXX_NOEXCEPT
: _Tp_alloc_type(__a), _M_map(0), _M_map_size(0),
_M_start(), _M_finish()
{ }
#if __cplusplus >= 201103L
_Deque_impl(_Tp_alloc_type&& __a)
_Deque_impl(_Tp_alloc_type&& __a) _GLIBCXX_NOEXCEPT
: _Tp_alloc_type(std::move(__a)), _M_map(0), _M_map_size(0),
_M_start(), _M_finish()
{ }
......@@ -538,7 +539,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
}
void
_M_deallocate_node(_Tp* __p)
_M_deallocate_node(_Tp* __p) _GLIBCXX_NOEXCEPT
{
_M_impl._Tp_alloc_type::deallocate(__p, __deque_buf_size(sizeof(_Tp)));
}
......@@ -548,13 +549,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
{ return _M_get_map_allocator().allocate(__n); }
void
_M_deallocate_map(_Tp** __p, size_t __n)
_M_deallocate_map(_Tp** __p, size_t __n) _GLIBCXX_NOEXCEPT
{ _M_get_map_allocator().deallocate(__p, __n); }
protected:
void _M_initialize_map(size_t);
void _M_create_nodes(_Tp** __nstart, _Tp** __nfinish);
void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish);
void _M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) _GLIBCXX_NOEXCEPT;
enum { _S_initial_map_size = 8 };
_Deque_impl _M_impl;
......@@ -562,7 +563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
_Deque_base<_Tp, _Alloc>::
~_Deque_base()
~_Deque_base() _GLIBCXX_NOEXCEPT
{
if (this->_M_impl._M_map)
{
......@@ -640,7 +641,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
template<typename _Tp, typename _Alloc>
void
_Deque_base<_Tp, _Alloc>::
_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish)
_M_destroy_nodes(_Tp** __nstart, _Tp** __nfinish) _GLIBCXX_NOEXCEPT
{
for (_Tp** __n = __nstart; __n < __nfinish; ++__n)
_M_deallocate_node(*__n);
......@@ -758,7 +759,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
protected:
typedef pointer* _Map_pointer;
static size_t _S_buffer_size()
static size_t _S_buffer_size() _GLIBCXX_NOEXCEPT
{ return __deque_buf_size(sizeof(_Tp)); }
// Functions controlling memory layout, and nothing else.
......@@ -781,18 +782,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
// [23.2.1.1] construct/copy/destroy
// (assign() and get_allocator() are also listed in this section)
/**
* @brief Default constructor creates no elements.
*/
deque()
: _Base() { }
/**
* @brief Creates a %deque with no elements.
* @param __a An allocator object.
*/
explicit
deque(const allocator_type& __a)
: _Base(__a, 0) { }
deque(const allocator_type& __a = allocator_type())
: _Base(__a) { }
#if __cplusplus >= 201103L
/**
......@@ -940,7 +935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* @a __x is a valid, but unspecified %deque.
*/
deque&
operator=(deque&& __x)
operator=(deque&& __x) noexcept
{
// NB: DR 1204.
// NB: DR 675.
......@@ -1220,7 +1215,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
#if __cplusplus >= 201103L
/** A non-binding request to reduce memory use. */
void
shrink_to_fit()
shrink_to_fit() noexcept
{ _M_shrink_to_fit(); }
#endif
......@@ -1245,7 +1240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* see at().)
*/
reference
operator[](size_type __n)
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_start[difference_type(__n)]; }
/**
......@@ -1260,7 +1255,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* see at().)
*/
const_reference
operator[](size_type __n) const
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{ return this->_M_impl._M_start[difference_type(__n)]; }
protected:
......@@ -1314,7 +1309,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %deque.
*/
reference
front()
front() _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
......@@ -1322,7 +1317,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %deque.
*/
const_reference
front() const
front() const _GLIBCXX_NOEXCEPT
{ return *begin(); }
/**
......@@ -1330,7 +1325,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* %deque.
*/
reference
back()
back() _GLIBCXX_NOEXCEPT
{
iterator __tmp = end();
--__tmp;
......@@ -1342,7 +1337,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* element of the %deque.
*/
const_reference
back() const
back() const _GLIBCXX_NOEXCEPT
{
const_iterator __tmp = end();
--__tmp;
......@@ -1422,7 +1417,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* needed, it should be retrieved before pop_front() is called.
*/
void
pop_front()
pop_front() _GLIBCXX_NOEXCEPT
{
if (this->_M_impl._M_start._M_cur
!= this->_M_impl._M_start._M_last - 1)
......@@ -1443,7 +1438,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* needed, it should be retrieved before pop_back() is called.
*/
void
pop_back()
pop_back() _GLIBCXX_NOEXCEPT
{
if (this->_M_impl._M_finish._M_cur
!= this->_M_impl._M_finish._M_first)
......@@ -1655,7 +1650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
* std::swap(d1,d2) will feed to this function.
*/
void
swap(deque& __x)
swap(deque& __x) _GLIBCXX_NOEXCEPT
{
std::swap(this->_M_impl._M_start, __x._M_impl._M_start);
std::swap(this->_M_impl._M_finish, __x._M_impl._M_finish);
......
......@@ -128,7 +128,7 @@ namespace __debug
#if __cplusplus >= 201103L
deque&
operator=(deque&& __x)
operator=(deque&& __x) noexcept
{
// NB: DR 1204.
// NB: DR 675.
......@@ -287,7 +287,7 @@ namespace __debug
#if __cplusplus >= 201103L
void
shrink_to_fit()
shrink_to_fit() noexcept
{
if (_Base::_M_shrink_to_fit())
this->_M_invalidate_all();
......@@ -298,14 +298,14 @@ namespace __debug
// element access:
reference
operator[](size_type __n)
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
}
const_reference
operator[](size_type __n) const
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
__glibcxx_check_subscript(__n);
return _M_base()[__n];
......@@ -314,28 +314,28 @@ namespace __debug
using _Base::at;
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();
......@@ -468,7 +468,7 @@ namespace __debug
#endif
void
pop_front()
pop_front() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(_Base::begin()));
......@@ -476,7 +476,7 @@ namespace __debug
}
void
pop_back()
pop_back() _GLIBCXX_NOEXCEPT
{
__glibcxx_check_nonempty();
this->_M_invalidate_if(_Equal(--_Base::end()));
......@@ -556,7 +556,7 @@ namespace __debug
}
void
swap(deque& __x)
swap(deque& __x) _GLIBCXX_NOEXCEPT
{
_Base::swap(__x);
this->_M_swap(__x);
......
......@@ -117,7 +117,7 @@ namespace __profile
#if __cplusplus >= 201103L
deque&
operator=(deque&& __x)
operator=(deque&& __x) noexcept
{
// NB: DR 1204.
// NB: DR 675.
......@@ -245,13 +245,13 @@ namespace __profile
// element access:
reference
operator[](size_type __n)
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
return _M_base()[__n];
}
const_reference
operator[](size_type __n) const
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
return _M_base()[__n];
}
......@@ -259,25 +259,25 @@ namespace __profile
using _Base::at;
reference
front()
front() _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
const_reference
front() const
front() const _GLIBCXX_NOEXCEPT
{
return _Base::front();
}
reference
back()
back() _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
const_reference
back() const
back() const _GLIBCXX_NOEXCEPT
{
return _Base::back();
}
......@@ -375,13 +375,13 @@ namespace __profile
#endif
void
pop_front()
pop_front() _GLIBCXX_NOEXCEPT
{
_Base::pop_front();
}
void
pop_back()
pop_back() _GLIBCXX_NOEXCEPT
{
_Base::pop_back();
}
......@@ -409,7 +409,7 @@ namespace __profile
}
void
swap(deque& __x)
swap(deque& __x) _GLIBCXX_NOEXCEPT
{
_Base::swap(__x);
}
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1760 }
// { dg-error "no matching" "" { target *-*-* } 1755 }
#include <deque>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1693 }
// { dg-error "no matching" "" { target *-*-* } 1688 }
#include <deque>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1693 }
// { dg-error "no matching" "" { target *-*-* } 1688 }
#include <deque>
#include <utility>
......
......@@ -18,7 +18,7 @@
// <http://www.gnu.org/licenses/>.
// { dg-do compile }
// { dg-error "no matching" "" { target *-*-* } 1844 }
// { dg-error "no matching" "" { target *-*-* } 1839 }
#include <deque>
......
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