public inbox for libstdc++-cvs@sourceware.org help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-9348] libstdc++: Make operator<< for stacktraces less templated (LWG 3515) Date: Tue, 28 Mar 2023 23:35:26 +0000 (GMT) [thread overview] Message-ID: <20230328233526.32029388B694@sourceware.org> (raw) https://gcc.gnu.org/g:f6c6df050a3e04744f81a471a53864ee2291ef4a commit r12-9348-gf6c6df050a3e04744f81a471a53864ee2291ef4a Author: Jonathan Wakely <jwakely@redhat.com> Date: Fri Dec 9 14:59:01 2022 +0000 libstdc++: Make operator<< for stacktraces less templated (LWG 3515) This change was approved for C++23 last month. libstdc++-v3/ChangeLog: * include/std/stacktrace (operator<<): Only output to narrow ostreams (LWG 3515). * testsuite/19_diagnostics/stacktrace/synopsis.cc: (cherry picked from commit 2327d9331430777006008ab3b051afe2b4fc15bd) Diff: --- libstdc++-v3/include/std/stacktrace | 38 ++++++++++------------ .../19_diagnostics/stacktrace/synopsis.cc | 11 +++---- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace index a067d629a16..a7fee8531f7 100644 --- a/libstdc++-v3/include/std/stacktrace +++ b/libstdc++-v3/include/std/stacktrace @@ -160,9 +160,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __state; } - template<typename _CharT, typename _Traits> - friend basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>&, const stacktrace_entry&); + friend ostream& + operator<<(ostream&, const stacktrace_entry&); bool _M_get_info(string* __desc, string* __file, int* __line) const @@ -713,25 +712,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION noexcept(noexcept(__a.swap(__b))) { __a.swap(__b); } - template<typename _CharT, typename _Traits> - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, - const stacktrace_entry& __f) - { - string __desc, __file; - int __line; - if (__f._M_get_info(&__desc, &__file, &__line)) - { - __os.width(4); - __os << __desc << " at " << __file << ':' << __line; - } - return __os; - } + inline ostream& + operator<<(ostream& __os, const stacktrace_entry& __f) + { + string __desc, __file; + int __line; + if (__f._M_get_info(&__desc, &__file, &__line)) + { + __os.width(4); + __os << __desc << " at " << __file << ':' << __line; + } + return __os; + } - template<typename _CharT, typename _Traits, typename _Allocator> - inline basic_ostream<_CharT, _Traits>& - operator<<(basic_ostream<_CharT, _Traits>& __os, - const basic_stacktrace<_Allocator>& __st) + template<typename _Allocator> + inline ostream& + operator<<(ostream& __os, const basic_stacktrace<_Allocator>& __st) { for (stacktrace::size_type __i = 0; __i < __st.size(); ++__i) { diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc index 72582fa53c6..262abea21ec 100644 --- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc +++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/synopsis.cc @@ -28,13 +28,12 @@ namespace std template<class Allocator> string to_string(const basic_stacktrace<Allocator>& st); - template<class charT, class traits> - basic_ostream<charT, traits>& - operator<<(basic_ostream<charT, traits>& os, const stacktrace_entry& f); + ostream& + operator<<(ostream& os, const stacktrace_entry& f); - template<class charT, class traits, class Allocator> - basic_ostream<charT, traits>& - operator<<(basic_ostream<charT, traits>& os, const basic_stacktrace<Allocator>& st); + template<class Allocator> + ostream& + operator<<(ostream& os, const basic_stacktrace<Allocator>& st); namespace pmr { using stacktrace = basic_stacktrace<polymorphic_allocator<stacktrace_entry>>;
reply other threads:[~2023-03-28 23: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=20230328233526.32029388B694@sourceware.org \ --to=redi@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).