mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-21 01:55:15 +08:00
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract)
2013-09-24 Marc Glisse <marc.glisse@inria.fr> PR libstdc++/58338 PR libstdc++/56166 * include/bits/basic_string.h (basic_string) [basic_string(basic_string&&)]: Make the noexcept conditional. [operator=(basic_string&&), assign(basic_string&&)]: Link to PR 58265. [begin(), end(), rbegin(), rend(), clear]: Remove noexcept. [pop_back]: Comment on the lack of noexcept. * include/debug/string (basic_string) [basic_string(const _Allocator&), basic_string(basic_string&&), begin(), end(), rbegin(), rend(), clear, operator[](size_type), pop_back]: Comment out noexcept, until vstring replaces basic_string. From-SVN: r202861
This commit is contained in:
parent
fae205619d
commit
63ebd8f129
@ -1,3 +1,17 @@
|
||||
2013-09-24 Marc Glisse <marc.glisse@inria.fr>
|
||||
|
||||
PR libstdc++/58338
|
||||
PR libstdc++/56166
|
||||
* include/bits/basic_string.h (basic_string)
|
||||
[basic_string(basic_string&&)]: Make the noexcept conditional.
|
||||
[operator=(basic_string&&), assign(basic_string&&)]: Link to PR 58265.
|
||||
[begin(), end(), rbegin(), rend(), clear]: Remove noexcept.
|
||||
[pop_back]: Comment on the lack of noexcept.
|
||||
* include/debug/string (basic_string) [basic_string(const _Allocator&),
|
||||
basic_string(basic_string&&), begin(), end(), rbegin(), rend(), clear,
|
||||
operator[](size_type), pop_back]: Comment out noexcept, until vstring
|
||||
replaces basic_string.
|
||||
|
||||
2013-09-24 Tim Shen <timshen91@gmail.com>
|
||||
|
||||
* include/Makefile.am: Add regex.tcc.
|
||||
|
@ -509,7 +509,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* The newly-created string contains the exact contents of @a __str.
|
||||
* @a __str is a valid, but unspecified string.
|
||||
**/
|
||||
basic_string(basic_string&& __str) noexcept
|
||||
basic_string(basic_string&& __str)
|
||||
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
|
||||
noexcept // FIXME C++11: should always be noexcept.
|
||||
#endif
|
||||
: _M_dataplus(__str._M_dataplus)
|
||||
{
|
||||
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
|
||||
@ -581,6 +584,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* The contents of @a str are moved into this string (without copying).
|
||||
* @a str is a valid, but unspecified string.
|
||||
**/
|
||||
// PR 58265, this should be noexcept.
|
||||
basic_string&
|
||||
operator=(basic_string&& __str)
|
||||
{
|
||||
@ -607,7 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* the %string. Unshares the string.
|
||||
*/
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
begin() // FIXME C++11: should be noexcept.
|
||||
{
|
||||
_M_leak();
|
||||
return iterator(_M_data());
|
||||
@ -626,7 +630,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* character in the %string. Unshares the string.
|
||||
*/
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
end() // FIXME C++11: should be noexcept.
|
||||
{
|
||||
_M_leak();
|
||||
return iterator(_M_data() + this->size());
|
||||
@ -646,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* order. Unshares the string.
|
||||
*/
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
rbegin() // FIXME C++11: should be noexcept.
|
||||
{ return reverse_iterator(this->end()); }
|
||||
|
||||
/**
|
||||
@ -664,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* element order. Unshares the string.
|
||||
*/
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
rend() // FIXME C++11: should be noexcept.
|
||||
{ return reverse_iterator(this->begin()); }
|
||||
|
||||
/**
|
||||
@ -806,7 +810,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
*/
|
||||
// PR 56166: this should not throw.
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
clear()
|
||||
{ _M_mutate(0, this->size(), 0); }
|
||||
|
||||
/**
|
||||
@ -1088,6 +1092,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* This function sets this string to the exact contents of @a __str.
|
||||
* @a __str is a valid, but unspecified string.
|
||||
*/
|
||||
// PR 58265, this should be noexcept.
|
||||
basic_string&
|
||||
assign(basic_string&& __str)
|
||||
{
|
||||
@ -1417,7 +1422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||
* The string must be non-empty.
|
||||
*/
|
||||
void
|
||||
pop_back()
|
||||
pop_back() // FIXME C++11: should be noexcept.
|
||||
{ erase(size()-1, 1); }
|
||||
#endif // C++11
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace __gnu_debug
|
||||
|
||||
// 21.3.1 construct/copy/destroy:
|
||||
explicit basic_string(const _Allocator& __a = _Allocator())
|
||||
_GLIBCXX_NOEXCEPT
|
||||
// _GLIBCXX_NOEXCEPT
|
||||
: _Base(__a)
|
||||
{ }
|
||||
|
||||
@ -114,7 +114,7 @@ namespace __gnu_debug
|
||||
{ }
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
basic_string(basic_string&& __str) noexcept
|
||||
basic_string(basic_string&& __str) // noexcept
|
||||
: _Base(std::move(__str))
|
||||
{ }
|
||||
|
||||
@ -172,7 +172,7 @@ namespace __gnu_debug
|
||||
|
||||
// 21.3.2 iterators:
|
||||
iterator
|
||||
begin() _GLIBCXX_NOEXCEPT
|
||||
begin() // _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::begin(), this); }
|
||||
|
||||
const_iterator
|
||||
@ -180,7 +180,7 @@ namespace __gnu_debug
|
||||
{ return const_iterator(_Base::begin(), this); }
|
||||
|
||||
iterator
|
||||
end() _GLIBCXX_NOEXCEPT
|
||||
end() // _GLIBCXX_NOEXCEPT
|
||||
{ return iterator(_Base::end(), this); }
|
||||
|
||||
const_iterator
|
||||
@ -188,7 +188,7 @@ namespace __gnu_debug
|
||||
{ return const_iterator(_Base::end(), this); }
|
||||
|
||||
reverse_iterator
|
||||
rbegin() _GLIBCXX_NOEXCEPT
|
||||
rbegin() // _GLIBCXX_NOEXCEPT
|
||||
{ return reverse_iterator(end()); }
|
||||
|
||||
const_reverse_iterator
|
||||
@ -196,7 +196,7 @@ namespace __gnu_debug
|
||||
{ return const_reverse_iterator(end()); }
|
||||
|
||||
reverse_iterator
|
||||
rend() _GLIBCXX_NOEXCEPT
|
||||
rend() // _GLIBCXX_NOEXCEPT
|
||||
{ return reverse_iterator(begin()); }
|
||||
|
||||
const_reverse_iterator
|
||||
@ -258,7 +258,7 @@ namespace __gnu_debug
|
||||
using _Base::reserve;
|
||||
|
||||
void
|
||||
clear() _GLIBCXX_NOEXCEPT
|
||||
clear() // _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
_Base::clear();
|
||||
this->_M_invalidate_all();
|
||||
@ -279,7 +279,7 @@ namespace __gnu_debug
|
||||
}
|
||||
|
||||
reference
|
||||
operator[](size_type __pos) _GLIBCXX_NOEXCEPT
|
||||
operator[](size_type __pos) // _GLIBCXX_NOEXCEPT
|
||||
{
|
||||
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
||||
__glibcxx_check_subscript(__pos);
|
||||
@ -583,7 +583,7 @@ namespace __gnu_debug
|
||||
|
||||
#if __cplusplus >= 201103L
|
||||
void
|
||||
pop_back() noexcept
|
||||
pop_back() // noexcept
|
||||
{
|
||||
__glibcxx_check_nonempty();
|
||||
_Base::pop_back();
|
||||
|
Loading…
Reference in New Issue
Block a user