mirror of git://gcc.gnu.org/git/gcc.git
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>
|
2013-09-24 Tim Shen <timshen91@gmail.com>
|
||||||
|
|
||||||
* include/Makefile.am: Add regex.tcc.
|
* 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.
|
* The newly-created string contains the exact contents of @a __str.
|
||||||
* @a __str is a valid, but unspecified string.
|
* @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)
|
: _M_dataplus(__str._M_dataplus)
|
||||||
{
|
{
|
||||||
#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
|
#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).
|
* The contents of @a str are moved into this string (without copying).
|
||||||
* @a str is a valid, but unspecified string.
|
* @a str is a valid, but unspecified string.
|
||||||
**/
|
**/
|
||||||
|
// PR 58265, this should be noexcept.
|
||||||
basic_string&
|
basic_string&
|
||||||
operator=(basic_string&& __str)
|
operator=(basic_string&& __str)
|
||||||
{
|
{
|
||||||
|
|
@ -607,7 +611,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
* the %string. Unshares the string.
|
* the %string. Unshares the string.
|
||||||
*/
|
*/
|
||||||
iterator
|
iterator
|
||||||
begin() _GLIBCXX_NOEXCEPT
|
begin() // FIXME C++11: should be noexcept.
|
||||||
{
|
{
|
||||||
_M_leak();
|
_M_leak();
|
||||||
return iterator(_M_data());
|
return iterator(_M_data());
|
||||||
|
|
@ -626,7 +630,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
* character in the %string. Unshares the string.
|
* character in the %string. Unshares the string.
|
||||||
*/
|
*/
|
||||||
iterator
|
iterator
|
||||||
end() _GLIBCXX_NOEXCEPT
|
end() // FIXME C++11: should be noexcept.
|
||||||
{
|
{
|
||||||
_M_leak();
|
_M_leak();
|
||||||
return iterator(_M_data() + this->size());
|
return iterator(_M_data() + this->size());
|
||||||
|
|
@ -646,7 +650,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
* order. Unshares the string.
|
* order. Unshares the string.
|
||||||
*/
|
*/
|
||||||
reverse_iterator
|
reverse_iterator
|
||||||
rbegin() _GLIBCXX_NOEXCEPT
|
rbegin() // FIXME C++11: should be noexcept.
|
||||||
{ return reverse_iterator(this->end()); }
|
{ return reverse_iterator(this->end()); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -664,7 +668,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
* element order. Unshares the string.
|
* element order. Unshares the string.
|
||||||
*/
|
*/
|
||||||
reverse_iterator
|
reverse_iterator
|
||||||
rend() _GLIBCXX_NOEXCEPT
|
rend() // FIXME C++11: should be noexcept.
|
||||||
{ return reverse_iterator(this->begin()); }
|
{ return reverse_iterator(this->begin()); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -806,7 +810,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
*/
|
*/
|
||||||
// PR 56166: this should not throw.
|
// PR 56166: this should not throw.
|
||||||
void
|
void
|
||||||
clear() _GLIBCXX_NOEXCEPT
|
clear()
|
||||||
{ _M_mutate(0, this->size(), 0); }
|
{ _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.
|
* This function sets this string to the exact contents of @a __str.
|
||||||
* @a __str is a valid, but unspecified string.
|
* @a __str is a valid, but unspecified string.
|
||||||
*/
|
*/
|
||||||
|
// PR 58265, this should be noexcept.
|
||||||
basic_string&
|
basic_string&
|
||||||
assign(basic_string&& __str)
|
assign(basic_string&& __str)
|
||||||
{
|
{
|
||||||
|
|
@ -1417,7 +1422,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
|
||||||
* The string must be non-empty.
|
* The string must be non-empty.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
pop_back()
|
pop_back() // FIXME C++11: should be noexcept.
|
||||||
{ erase(size()-1, 1); }
|
{ erase(size()-1, 1); }
|
||||||
#endif // C++11
|
#endif // C++11
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ namespace __gnu_debug
|
||||||
|
|
||||||
// 21.3.1 construct/copy/destroy:
|
// 21.3.1 construct/copy/destroy:
|
||||||
explicit basic_string(const _Allocator& __a = _Allocator())
|
explicit basic_string(const _Allocator& __a = _Allocator())
|
||||||
_GLIBCXX_NOEXCEPT
|
// _GLIBCXX_NOEXCEPT
|
||||||
: _Base(__a)
|
: _Base(__a)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ namespace __gnu_debug
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
basic_string(basic_string&& __str) noexcept
|
basic_string(basic_string&& __str) // noexcept
|
||||||
: _Base(std::move(__str))
|
: _Base(std::move(__str))
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
|
|
@ -172,7 +172,7 @@ namespace __gnu_debug
|
||||||
|
|
||||||
// 21.3.2 iterators:
|
// 21.3.2 iterators:
|
||||||
iterator
|
iterator
|
||||||
begin() _GLIBCXX_NOEXCEPT
|
begin() // _GLIBCXX_NOEXCEPT
|
||||||
{ return iterator(_Base::begin(), this); }
|
{ return iterator(_Base::begin(), this); }
|
||||||
|
|
||||||
const_iterator
|
const_iterator
|
||||||
|
|
@ -180,7 +180,7 @@ namespace __gnu_debug
|
||||||
{ return const_iterator(_Base::begin(), this); }
|
{ return const_iterator(_Base::begin(), this); }
|
||||||
|
|
||||||
iterator
|
iterator
|
||||||
end() _GLIBCXX_NOEXCEPT
|
end() // _GLIBCXX_NOEXCEPT
|
||||||
{ return iterator(_Base::end(), this); }
|
{ return iterator(_Base::end(), this); }
|
||||||
|
|
||||||
const_iterator
|
const_iterator
|
||||||
|
|
@ -188,7 +188,7 @@ namespace __gnu_debug
|
||||||
{ return const_iterator(_Base::end(), this); }
|
{ return const_iterator(_Base::end(), this); }
|
||||||
|
|
||||||
reverse_iterator
|
reverse_iterator
|
||||||
rbegin() _GLIBCXX_NOEXCEPT
|
rbegin() // _GLIBCXX_NOEXCEPT
|
||||||
{ return reverse_iterator(end()); }
|
{ return reverse_iterator(end()); }
|
||||||
|
|
||||||
const_reverse_iterator
|
const_reverse_iterator
|
||||||
|
|
@ -196,7 +196,7 @@ namespace __gnu_debug
|
||||||
{ return const_reverse_iterator(end()); }
|
{ return const_reverse_iterator(end()); }
|
||||||
|
|
||||||
reverse_iterator
|
reverse_iterator
|
||||||
rend() _GLIBCXX_NOEXCEPT
|
rend() // _GLIBCXX_NOEXCEPT
|
||||||
{ return reverse_iterator(begin()); }
|
{ return reverse_iterator(begin()); }
|
||||||
|
|
||||||
const_reverse_iterator
|
const_reverse_iterator
|
||||||
|
|
@ -258,7 +258,7 @@ namespace __gnu_debug
|
||||||
using _Base::reserve;
|
using _Base::reserve;
|
||||||
|
|
||||||
void
|
void
|
||||||
clear() _GLIBCXX_NOEXCEPT
|
clear() // _GLIBCXX_NOEXCEPT
|
||||||
{
|
{
|
||||||
_Base::clear();
|
_Base::clear();
|
||||||
this->_M_invalidate_all();
|
this->_M_invalidate_all();
|
||||||
|
|
@ -279,7 +279,7 @@ namespace __gnu_debug
|
||||||
}
|
}
|
||||||
|
|
||||||
reference
|
reference
|
||||||
operator[](size_type __pos) _GLIBCXX_NOEXCEPT
|
operator[](size_type __pos) // _GLIBCXX_NOEXCEPT
|
||||||
{
|
{
|
||||||
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
#ifdef _GLIBCXX_DEBUG_PEDANTIC
|
||||||
__glibcxx_check_subscript(__pos);
|
__glibcxx_check_subscript(__pos);
|
||||||
|
|
@ -583,7 +583,7 @@ namespace __gnu_debug
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
void
|
void
|
||||||
pop_back() noexcept
|
pop_back() // noexcept
|
||||||
{
|
{
|
||||||
__glibcxx_check_nonempty();
|
__glibcxx_check_nonempty();
|
||||||
_Base::pop_back();
|
_Base::pop_back();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue