From patchwork Wed Mar 13 23:55:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1911941 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=TDsIyzFQ; 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 4Tw6qc54pgz1yWn for ; Thu, 14 Mar 2024 10:56:44 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F20543857BA2 for ; Wed, 13 Mar 2024 23:56:40 +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 934293858D33 for ; Wed, 13 Mar 2024 23:56:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 934293858D33 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 934293858D33 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=1710374179; cv=none; b=ODg+A8TIvFXFIQjxBNxc3Zc1LOTF5ytUxpvB2S6FsLQGP27t13UO9W1jN8xiRIN4w3RWeDM4Is5gijJYQvd6sB5UnZzd3ugTzGhkQLu5qv5LaPHrpmVT8Q2C53fQ+mUX6wHd5Dvrr+5+QkPNIq4HjfFspgHLlh14M7L4R7hkqTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1710374179; c=relaxed/simple; bh=+8Tg2fKlHr7hN503HvV87tiGVffkaO+6ym5Fvk7zeOk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=m+xdodll0CToqtgBJJ0pmR2by2KGi98yuMUqrLO/jXQDi1NQxF4cZjtiF+kOfQ5+r4dCUqtgZoq13BhbSnHgEvYW/k1M6D43YUGfmbRXkDfC0YpQjEo4c5a+pW1HWOHSCXC6RgaGUz9v68Agfnd7wz67zYySZ/SxbUuUeJWPOnQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710374177; 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=HS0NY9ydweQqEZlhVrpBhFsLdg5QN5MSc3DP+E/e9uQ=; b=TDsIyzFQ2tQ3L4pOzP10pSCW1tgpqQB1hxr96q+vRV/ampmWCe7dnhSMARDpiIX4w9O2/2 V3EHAPbU4DgTxSud0FN2PkXqWf6sGKU6H+0g7FdkcoRea5ocz1ITZKncwCJFs02m77dwcI ciDILFOR0bfH1pr64IEEckwT2ex+X8Q= 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-453-uWl1KFK5My2F6mG9yWVcJw-1; Wed, 13 Mar 2024 19:56:15 -0400 X-MC-Unique: uWl1KFK5My2F6mG9yWVcJw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (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 BFD188007A3; Wed, 13 Mar 2024 23:56:14 +0000 (UTC) Received: from localhost (unknown [10.42.28.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8D0C8492BD0; Wed, 13 Mar 2024 23:56:14 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Move test error_category to global scope Date: Wed, 13 Mar 2024 23:55:33 +0000 Message-ID: <20240313235614.2605581-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 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, 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 with GDB 14.1 on x86_64-linux. I'll backport this too. -- >8 -- A recent GDB change causes this test to fail due to missing RTTI for the custom_cast type. This is presumably because the custom_cat type was defined as a local class, so has no linkage. Moving it to local scope seems to fix the test regressions, and probably makes the test more realistic as a local class with no linkage isn't practical to use as an error category that almost certainly needs to be referred to in other scopes. libstdc++-v3/ChangeLog: * testsuite/libstdc++-prettyprinters/cxx11.cc: Move custom_cat to namespace scope. --- .../testsuite/libstdc++-prettyprinters/cxx11.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc index f867ea18306..2f75d12703c 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx11.cc @@ -63,6 +63,11 @@ struct datum std::unique_ptr global; +struct custom_cat : std::error_category { + const char* name() const noexcept { return "miaow"; } + std::string message(int) const { return ""; } +}; + int main() { @@ -179,10 +184,7 @@ main() std::error_condition ecinval = std::make_error_condition(std::errc::invalid_argument); // { dg-final { note-test ecinval {std::error_condition = {"generic": EINVAL}} } } - struct custom_cat : std::error_category { - const char* name() const noexcept { return "miaow"; } - std::string message(int) const { return ""; } - } cat; + custom_cat cat; std::error_code emiaow(42, cat); // { dg-final { note-test emiaow {std::error_code = {custom_cat: 42}} } } std::error_condition ecmiaow(42, cat);