aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2018-08-16 16:56:21 +0100
committerJonathan Wakely <redi@gcc.gnu.org>2018-08-16 16:56:21 +0100
commit891b1d6872ecf18ccf605d036f8f01dec32d66a4 (patch)
tree2a4b0d2ec1f3e6a73c8b43e0718ce39be3d4862b
parent3f6677f418564e634e3b77b0fc385891d1fdf1da (diff)
downloadgcc-891b1d6872ecf18ccf605d036f8f01dec32d66a4.zip
gcc-891b1d6872ecf18ccf605d036f8f01dec32d66a4.tar.gz
gcc-891b1d6872ecf18ccf605d036f8f01dec32d66a4.tar.bz2
Fix bootstrap with --enable-fully-dynamic-string
PR libstdc++/86447 * src/c++11/cow-stdexcept.cc [_GLIBCXX_FULLY_DYNAMIC_STRING] (logic_error::logic_error(logic_error&&)) (logic_error::operator=(logic_error&&)) (runtime_error::runtime_error(runtime_error&&)) (runtime_error::operator=(runtime_error&&)): Copy strings instead of moving, to avoid allocating empty reps for moved-from strings. From-SVN: r263590
-rw-r--r--libstdc++-v3/ChangeLog10
-rw-r--r--libstdc++-v3/src/c++11/cow-stdexcept.cc20
2 files changed, 30 insertions, 0 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ce8ccaf..6c277ff 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,13 @@
+2018-08-16 Jonathan Wakely <jwakely@redhat.com>
+
+ PR libstdc++/86447
+ * src/c++11/cow-stdexcept.cc [_GLIBCXX_FULLY_DYNAMIC_STRING]
+ (logic_error::logic_error(logic_error&&))
+ (logic_error::operator=(logic_error&&))
+ (runtime_error::runtime_error(runtime_error&&))
+ (runtime_error::operator=(runtime_error&&)): Copy strings instead of
+ moving, to avoid allocating empty reps for moved-from strings.
+
2018-08-15 Jonathan Wakely <jwakely@redhat.com>
* include/experimental/regex: Remove begin/end macros for namespace.
diff --git a/libstdc++-v3/src/c++11/cow-stdexcept.cc b/libstdc++-v3/src/c++11/cow-stdexcept.cc
index 54859d5..d271be5 100644
--- a/libstdc++-v3/src/c++11/cow-stdexcept.cc
+++ b/libstdc++-v3/src/c++11/cow-stdexcept.cc
@@ -57,6 +57,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// These operations are noexcept even though copying a COW string is not,
// but we know that the string member in an exception has not been "leaked"
// so copying is a simple reference count increment.
+ // For the fully dynamic string moves are not noexcept (due to needing to
+ // allocate an empty string) so we just define the moves as copies here.
logic_error::logic_error(const logic_error& e) noexcept
: exception(e), _M_msg(e._M_msg) { }
@@ -64,10 +66,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
logic_error& logic_error::operator=(const logic_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
+#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
logic_error::logic_error(logic_error&& e) noexcept = default;
logic_error&
logic_error::operator=(logic_error&& e) noexcept = default;
+#else
+ logic_error::logic_error(logic_error&& e) noexcept
+ : exception(e), _M_msg(e._M_msg) { }
+
+ logic_error&
+ logic_error::operator=(logic_error&& e) noexcept
+ { _M_msg = e._M_msg; return *this; }
+#endif
runtime_error::runtime_error(const runtime_error& e) noexcept
: exception(e), _M_msg(e._M_msg) { }
@@ -76,10 +87,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
runtime_error::operator=(const runtime_error& e) noexcept
{ _M_msg = e._M_msg; return *this; }
+#if _GLIBCXX_FULLY_DYNAMIC_STRING == 0
runtime_error::runtime_error(runtime_error&& e) noexcept = default;
runtime_error&
runtime_error::operator=(runtime_error&& e) noexcept = default;
+#else
+ runtime_error::runtime_error(runtime_error&& e) noexcept
+ : exception(e), _M_msg(e._M_msg) { }
+
+ runtime_error&
+ runtime_error::operator=(runtime_error&& e) noexcept
+ { _M_msg = e._M_msg; return *this; }
+#endif
// New C++11 constructors: