public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc(refs/vendors/redhat/heads/gcc-8-branch)] PR libstdc++/78552 only construct std::locale for C locale once Date: Thu, 17 Sep 2020 16:48:00 +0000 (GMT) [thread overview] Message-ID: <20200917164800.82D08398B86D@sourceware.org> (raw) https://gcc.gnu.org/g:d6c8aad430338fdc4017918a9e520949a4a01d9e commit d6c8aad430338fdc4017918a9e520949a4a01d9e Author: Jonathan Wakely <jwakely@redhat.com> Date: Wed Feb 26 09:43:59 2020 +0000 PR libstdc++/78552 only construct std::locale for C locale once Backport from mainline 2019-10-09 Jonathan Wakely <jwakely@redhat.com> PR libstdc++/78552 * src/c++98/locale_init.cc (locale::classic()): Do not construct a new locale object for every call. (locale::_S_initialize_once()): Construct C locale here. Diff: --- libstdc++-v3/ChangeLog | 8 ++++++++ libstdc++-v3/src/c++98/locale_init.cc | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ab768b957c4..8b4637246b9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,5 +1,13 @@ 2020-02-26 Jonathan Wakely <jwakely@redhat.com> + Backport from mainline + 2019-10-09 Jonathan Wakely <jwakely@redhat.com> + + PR libstdc++/78552 + * src/c++98/locale_init.cc (locale::classic()): Do not construct a new + locale object for every call. + (locale::_S_initialize_once()): Construct C locale here. + Backport from mainline 2020-01-23 Jonathan Wakely <jwakely@redhat.com> diff --git a/libstdc++-v3/src/c++98/locale_init.cc b/libstdc++-v3/src/c++98/locale_init.cc index fb3d8ab972a..3ee4da3d9ad 100644 --- a/libstdc++-v3/src/c++98/locale_init.cc +++ b/libstdc++-v3/src/c++98/locale_init.cc @@ -296,7 +296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION locale::classic() { _S_initialize(); - return *(new (&c_locale) locale(_S_classic)); + return *(const locale*)c_locale; } void @@ -306,6 +306,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION // One reference for _S_classic, one for _S_global _S_classic = new (&c_locale_impl) _Impl(2); _S_global = _S_classic; + new (&c_locale) locale(_S_classic); } void
reply other threads:[~2020-09-17 16:48 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=20200917164800.82D08398B86D@sourceware.org \ --to=jakub@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: linkBe 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).