public inbox for libstdc++-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-786] libstdc++: Fix atomic and error_code printers for versioned namespace
Date: Thu, 26 May 2022 21:31:12 +0000 (GMT)	[thread overview]
Message-ID: <20220526213112.2EFE7382F9AE@sourceware.org> (raw)

https://gcc.gnu.org/g:11e1ee1b38f0d3a825b0cb70122cb345636b0534

commit r13-786-g11e1ee1b38f0d3a825b0cb70122cb345636b0534
Author: Jonathan Wakely <jwakely@redhat.com>
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.

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)


                 reply	other threads:[~2022-05-26 21:31 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=20220526213112.2EFE7382F9AE@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).