From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 3AC8A3829BE3; Fri, 27 May 2022 17:34:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3AC8A3829BE3 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-8428] libstdc++: Fix atomic and error_code printers for versioned namespace X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-12 X-Git-Oldrev: 2a9c87a204058586e62363dd06144db4b14e7562 X-Git-Newrev: 01ee07a0ddc29f6e9e7d95da6a9af703714db7a6 Message-Id: <20220527173416.3AC8A3829BE3@sourceware.org> Date: Fri, 27 May 2022 17:34:16 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 27 May 2022 17:34:16 -0000 https://gcc.gnu.org/g:01ee07a0ddc29f6e9e7d95da6a9af703714db7a6 commit r12-8428-g01ee07a0ddc29f6e9e7d95da6a9af703714db7a6 Author: Jonathan Wakely Date: Thu May 26 15:44:08 2022 +0100 libstdc++: Fix atomic and error_code printers for versioned namespace 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. (cherry picked from commit 11e1ee1b38f0d3a825b0cb70122cb345636b0534) Diff: --- 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)