public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/wschmidt/heads/builtins3)] libstdc++: Check __cpp_exceptions in basic_string::reserve()
@ 2020-08-18 18:34 William Schmidt
0 siblings, 0 replies; only message in thread
From: William Schmidt @ 2020-08-18 18:34 UTC (permalink / raw)
To: gcc-cvs, libstdc++-cvs
https://gcc.gnu.org/g:8bd92d8097d44be01a2bc7e14f7916d151dffcd6
commit 8bd92d8097d44be01a2bc7e14f7916d151dffcd6
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Mon Aug 10 12:02:18 2020 +0100
libstdc++: Check __cpp_exceptions in basic_string::reserve()
If exceptions are disabled then reallocating could abort, so ignore
shrink-to-fit requests.
libstdc++-v3/ChangeLog:
* include/bits/basic_string.tcc [_GLIBCXX_USE_CXX11_ABI=0]
(basic_string::reserve()): Do nothing if exceptions are not
enabled.
Diff:
---
libstdc++-v3/include/bits/basic_string.tcc | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libstdc++-v3/include/bits/basic_string.tcc b/libstdc++-v3/include/bits/basic_string.tcc
index a64b63a37fb..95d2fdbd6d6 100644
--- a/libstdc++-v3/include/bits/basic_string.tcc
+++ b/libstdc++-v3/include/bits/basic_string.tcc
@@ -1179,6 +1179,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
basic_string<_CharT, _Traits, _Alloc>::
reserve()
{
+#if __cpp_exceptions
if (length() < capacity() || _M_rep()->_M_is_shared())
try
{
@@ -1191,6 +1192,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ throw; }
catch (...)
{ /* swallow the exception */ }
+#endif
}
template<typename _CharT, typename _Traits, typename _Alloc>
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-08-18 18:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-18 18:34 [gcc(refs/users/wschmidt/heads/builtins3)] libstdc++: Check __cpp_exceptions in basic_string::reserve() William Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).