From patchwork Wed Nov 15 11:28:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1864193 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=TTF21akf; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SVgvH5Sjwz1yRG for ; Wed, 15 Nov 2023 22:30:19 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 08F073858420 for ; Wed, 15 Nov 2023 11:30:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id B729F3858D37 for ; Wed, 15 Nov 2023 11:30:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org B729F3858D37 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org B729F3858D37 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700047806; cv=none; b=dDdUccRj01jr37m0xnmyXHY7YSlwqeaks9MhmSkIdItO+EfifNSIV1NNvLiCr+YrnS1mODHanGrN/vzU8YTxYGCbzzrxj2yZXunUo/Gxy5ZmSR/nlE5hl+8B2P4P9DHDiBOegFoFbTDvAyo3rSJdy6KCiDpsTLE6Bk7kMrAnjrM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700047806; c=relaxed/simple; bh=EY8fcfWfLjhAhEL+KCeq0Jqmj/EPY5pXM+K57rgKWGA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=H3klh91IMeSVqILqtD4LTNehd5tzoeUnQIgz54iB9qQWgHdXs4Q/QM6uYvUPeevVKtjL8G2uB03Kes9qTvIpQvOWMHt8GD+9ubUaQqi7+8wA+Ls4MdHsiAaLuggKTl9qitMD8Qn9J0TmUW2m3EzTPiZ7j6oKv0dJheXjBDN2yAY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700047804; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8mC15A4FuUY0kvDWv4G+qU5pQC7YCONESi4rdAjvW30=; b=TTF21akf/arOopRcTvOTI++QDb3tHLhVp50LvSKscozIynb6FyRWtsPXDa/O1AHOjj0yV8 6K+IKpLJU0lTlQcd/tZO/GDPM5yPWobWMmpGoZpo7NC+jeKRYBK6A/5uNMMXblYg5UbcSw 2t9fwcNuUWY5Qh4TddWGmAqcNVnyhKs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-269-GtqG5540NvqXrr5ggkiSfw-1; Wed, 15 Nov 2023 06:30:03 -0500 X-MC-Unique: GtqG5540NvqXrr5ggkiSfw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B44F9811E82; Wed, 15 Nov 2023 11:30:02 +0000 (UTC) Received: from localhost (unknown [10.42.28.9]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60DF72026D66; Wed, 15 Nov 2023 11:30:02 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: std::stacktrace tweaks Date: Wed, 15 Nov 2023 11:28:38 +0000 Message-ID: <20231115113001.1048257-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.8 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Tested x86_64-linux. Pushed to trunk. Backports to follow. The new hash.cc test was failing for armv8l-unknown-linux-gnueabihf according to Linaro CI. This should fix it (but there are still other failures for std::stacktrace, so I opened PR 112541). -- >8 -- 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. --- 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 9a0d0b16068..9d5f6396aed 100644 --- a/libstdc++-v3/include/std/stacktrace +++ b/libstdc++-v3/include/std/stacktrace @@ -425,7 +425,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 88831efd687..21705098ff0 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; using S = std::basic_stacktrace; S s; + S cur = S::current(); std::size_t h = std::hash()(s); - std::size_t h2 = std::hash()(S::current()); - VERIFY( h != h2 ); + std::size_t h2 = std::hash()(cur); + VERIFY( cur.empty() == (h == h2) ); } int main()