From patchwork Thu May 26 21:31:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1635991 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=W3K0bSRw; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4L8Lm42jxCz9s2R for ; Fri, 27 May 2022 07:33:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6874F3846056 for ; Thu, 26 May 2022 21:33:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6874F3846056 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1653600834; bh=B58B/JdhuGzsoXfQmWO14l1is6iJBhFlY1v2af81YJI=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=W3K0bSRw0gigQ5v92A/k9ZHqkt2Os5/Ch3DhcU1eunv8hbJYGtw45PAneoL8q82ux tH8Yz4gIo6isrvk7K7H7EOL7a2rZBWjF07XDQ75vYsPTcgFiFERDfjWKhy1/SXrBKt xyuj/AKuP+px545I4w9fuhW+NCEelJNAusM+WLAE= 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.133.124]) by sourceware.org (Postfix) with ESMTPS id 5DAA9382E904 for ; Thu, 26 May 2022 21:31:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5DAA9382E904 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-1sZerEevNwS3QofFb2_tGQ-1; Thu, 26 May 2022 17:31:53 -0400 X-MC-Unique: 1sZerEevNwS3QofFb2_tGQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 5200D858F00; Thu, 26 May 2022 21:31:53 +0000 (UTC) Received: from localhost (unknown [10.33.36.185]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18380492CA2; Thu, 26 May 2022 21:31:52 +0000 (UTC) To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed] libstdc++: Fix atomic and error_code printers for versioned namespace Date: Thu, 26 May 2022 22:31:52 +0100 Message-Id: <20220526213152.1314068-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" Tested x86_64-linux, pushed to trunk. -- >8 -- This fixes the printers to work with std::__8::atomic and std::__v8::ios_errc and std::__v8::future_errc. libstdc++-v3/ChangeLog: * python/libstdcxx/v6/printers.py (StdErrorCodePrinter): Make lookup for ios_errc and future_errc check versioned namespace. (StdAtomicPrinter): Strip versioned namespace from typename. --- libstdc++-v3/python/libstdcxx/v6/printers.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index d47f9f27662..17c33c1e54f 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1551,6 +1551,15 @@ class StdErrorCodePrinter: return typ return None + @classmethod + def _find_standard_errc_enum(cls, name): + for ns in ['', _versioned_namespace]: + try: + qname = 'std::{}{}'.format(ns, name) + return cls._find_errc_enum(qname) + except RuntimeError: + pass + @classmethod def _match_net_ts_category(cls, cat): net_cats = ['stream', 'socket', 'ip::resolver'] @@ -1592,10 +1601,10 @@ class StdErrorCodePrinter: is_errno = cls._system_is_posix if typ.tag.endswith('::future_error_category'): name = 'future' - enum = cls._find_errc_enum('std::future_errc') + enum = cls._find_standard_errc_enum('future_errc') if typ.tag.endswith('::io_error_category'): name = 'io' - enum = cls._find_errc_enum('std::io_errc') + enum = cls._find_standard_errc_enum('io_errc') if name is None: try: @@ -1725,7 +1734,7 @@ class StdAtomicPrinter: "Print a std:atomic" def __init__(self, typename, val): - self.typename = typename + self.typename = strip_versioned_namespace(typename) self.val = val self.shptr_printer = None self.value_type = self.val.type.template_argument(0)