public inbox for gcc-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 r13-8071] libstdc++: std::stacktrace tweaks
Date: Wed, 15 Nov 2023 11:32:56 +0000 (GMT)	[thread overview]
Message-ID: <20231115113256.B5B053858D35@sourceware.org> (raw)

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

commit r13-8071-gb51b9e0861548e4b7a77f1d2cfcecb26440a0859
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Nov 15 09:17:49 2023 +0000

    libstdc++: std::stacktrace tweaks
    
    Fix a typo in a string literal and make the new hash.cc test gracefully
    handle missing stacktrace data (see PR 112541).
    
    libstdc++-v3/ChangeLog:
    
            * include/std/stacktrace (basic_stacktrace::at): Fix class name
            in exception message.
            * testsuite/19_diagnostics/stacktrace/hash.cc: Do not fail if
            current() returns a non-empty stacktrace.
    
    (cherry picked from commit cbd0fe22a5ced9751d2450dc4fd6fe3525c2fc02)

Diff:
---
 libstdc++-v3/include/std/stacktrace                      | 2 +-
 libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/libstdc++-v3/include/std/stacktrace b/libstdc++-v3/include/std/stacktrace
index 96702935433..e4ca2d6bfa9 100644
--- a/libstdc++-v3/include/std/stacktrace
+++ b/libstdc++-v3/include/std/stacktrace
@@ -496,7 +496,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       at(size_type __n) const
       {
 	if (__n >= size())
-	  __throw_out_of_range("basic_stack_trace::at: bad frame number");
+	  __throw_out_of_range("basic_stacktrace::at: bad frame number");
 	return begin()[__n];
       }
 
diff --git a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
index cf18476f2a7..a2f61e49981 100644
--- a/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
+++ b/libstdc++-v3/testsuite/19_diagnostics/stacktrace/hash.cc
@@ -12,9 +12,10 @@ test_hash()
   using Alloc = __gnu_test::uneq_allocator<std::stacktrace_entry>;
   using S = std::basic_stacktrace<Alloc>;
   S s;
+  S cur = S::current();
   std::size_t h = std::hash<S>()(s);
-  std::size_t h2 = std::hash<S>()(S::current());
-  VERIFY( h != h2 );
+  std::size_t h2 = std::hash<S>()(cur);
+  VERIFY( cur.empty() == (h == h2) );
 }
 
 int main()

                 reply	other threads:[~2023-11-15 11:32 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=20231115113256.B5B053858D35@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: 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).