]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/58338 (Add noexcept to functions with a narrow contract)
authorMarc Glisse <marc.glisse@inria.fr>
Tue, 24 Sep 2013 10:07:32 +0000 (12:07 +0200)
committerMarc Glisse <glisse@gcc.gnu.org>
Tue, 24 Sep 2013 10:07:32 +0000 (10:07 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/basic_string.h
libstdc++-v3/include/debug/string

index 432c36a151b5e17a9693ea64629c2496e9cb0bf7..2cff0aba190fb88bb9323853f0248b7eff2f1ff2 100644 (file)
@@ -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.
index 566186f4d172c5671f3e9b9e2968939aa9a1328c..db01eb7dace365cc3c9a9feddfe4a31b6a234121 100644 (file)
@@ -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
 
index 925575e662a8645b20a313cf5b266c6825799f5c..6d2c5395ade2adee636ee0b3e545d56a8f50e306 100644 (file)
@@ -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();