public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Ville Voutilainen <ville.voutilainen@gmail.com>
To: "libstdc++" <libstdc++@gcc.gnu.org>,
		"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: [v3 PATCH] Adjust optional's pretty printer for LWG 2900.
Date: Wed, 29 Mar 2017 12:02:00 -0000	[thread overview]
Message-ID: <CAFk2RUacv4OaP+tWrAnWtnuya+rWSkGURb_X9VkaBJdVH8i59A@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 277 bytes --]

Tested on Linux-x64.

2017-03-29  Ville Voutilainen  <ville.voutilainen@gmail.com>

    Adjust optional's pretty printer for LWG 2900.
    * python/libstdcxx/v6/printers.py (StdExpOptionalPrinter::__init__):
    Look at the nested payload in case of non-experimental optional.

[-- Attachment #2: opt-pp.diff --]
[-- Type: text/plain, Size: 843 bytes --]

diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py
index 14025dd..a67b27a 100644
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1023,6 +1023,8 @@ class StdExpOptionalPrinter(SingleObjContainerPrinter):
         valtype = self._recognize (val.type.template_argument(0))
         self.typename = re.sub('^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3<%s>' % valtype, typename, 1)
         self.typename = strip_versioned_namespace(self.typename)
+        if not self.typename.startswith('std::experimental'):
+            val = val['_M_payload']
         self.val = val
         contained_value = val['_M_payload'] if self.val['_M_engaged'] else None
         visualizer = gdb.default_visualizer (val['_M_payload'])

             reply	other threads:[~2017-03-29 11:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-29 12:02 Ville Voutilainen [this message]
2017-03-29 13:00 ` Jonathan Wakely

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=CAFk2RUacv4OaP+tWrAnWtnuya+rWSkGURb_X9VkaBJdVH8i59A@mail.gmail.com \
    --to=ville.voutilainen@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@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).