public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Giuliano Belinassi <giulianob@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc(refs/users/giulianob/heads/autopar_rebase2)] libstdc++: Check __cpp_exceptions in basic_string::reserve()
Date: Tue, 18 Aug 2020 01:35:04 +0000 (GMT)	[thread overview]
Message-ID: <20200818013504.599F639450EA@sourceware.org> (raw)

https://gcc.gnu.org/g:dcabf1582dfa1b858a827ed4040cce5a6dcd27c9

commit dcabf1582dfa1b858a827ed4040cce5a6dcd27c9
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>


                 reply	other threads:[~2020-08-18  1:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200818013504.599F639450EA@sourceware.org \
    --to=giulianob@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).