From patchwork Tue Dec 6 14:37:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 86850 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp2316955obb; Tue, 6 Dec 2016 06:37:29 -0800 (PST) X-Received: by 10.99.106.200 with SMTP id f191mr112522831pgc.143.1481035049777; Tue, 06 Dec 2016 06:37:29 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t135si19701718pgc.127.2016.12.06.06.37.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Dec 2016 06:37:29 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443596-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443596-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443596-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=wva5E8t3H1fGvMA7L LjbjW5FbURsjwn/Yr1DUZtknlvCOsnelKj6970knRhWQKsRLAS9nyzbKuuN8mfAj 8y3kTcr+S0lkZqFWQpn61LxYjHqxpzo5rNfy8HVuHxHHxeewWU5hgGDW7USKvrTa pUTkzupWHAxKtWYUxh3bqZDQ00= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=3iveHY7cjDegrWMm7vwngdP gWrk=; b=hdTV9rfiu4yqlTfki6vuLOl28+H5d4ROONlCbkIh9Wf75+EWf1M0Y45 SZmQWWpKnMyZhgHIEsjQgcfalhglXD0FFlsXPEdUudQcUz7h8y1oJoEHTjiLJMAl GCdJWLZ2kG0VgnV36WMXm2FrzMbr88QKNkq/ApNavN+b3AkE2eBo= Received: (qmail 57449 invoked by alias); 6 Dec 2016 14:37:17 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 57397 invoked by uid 89); 6 Dec 2016 14:37:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:2312, visit, super X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 06 Dec 2016 14:37:06 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC7ED624AA; Tue, 6 Dec 2016 14:37:04 +0000 (UTC) Received: from localhost (ovpn-116-110.ams2.redhat.com [10.36.116.110]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uB6Eb3qx004012; Tue, 6 Dec 2016 09:37:04 -0500 Date: Tue, 6 Dec 2016 14:37:03 +0000 From: Jonathan Wakely To: Tim Shen Cc: libstdc++ , gcc-patches Subject: Re: [Patches] Add variant constexpr support for visit, comparisons and get Message-ID: <20161206143703.GM6326@redhat.com> References: <20161130162729.GU3301@redhat.com> <20161206103053.GC6326@redhat.com> <20161206124934.GK6326@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20161206124934.GK6326@redhat.com> X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.7.1 (2016-10-04) On 06/12/16 12:49 +0000, Jonathan Wakely wrote: >On 06/12/16 03:52 -0800, Tim Shen wrote: >>On Tue, Dec 6, 2016 at 2:30 AM, Jonathan Wakely wrote: >>>This looks good - OK for trunk, thanks! >> >>Committed. >> >>Thanks! > >ChangeLog dates fixed by this patch. And pretty printer fixed by this one. The "vref" test originally testsed variant but is no longer needed, as that isn't supported. Tested x86_64-linux, committed to trunk. commit 2f135ef76712b96e3dd799dfbb17e8d16545b115 Author: Jonathan Wakely Date: Tue Dec 6 14:24:13 2016 +0000 Fix pretty-printer for std::variant * python/libstdcxx/v6/printers.py (StdVariantPrinter): Update for new data member name. * testsuite/libstdc++-prettyprinters/cxx17.cc: Remove redundant test. diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index bad42b4..ff428e8 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -1002,7 +1002,7 @@ class StdVariantPrinter(SingleObjContainerPrinter): visualizer = None else: self.contained_type = alternatives[int(self.index)] - addr = val['_M_union']['_M_first']['_M_storage'].address + addr = val['_M_u']['_M_first']['_M_storage'].address contained_value = addr.cast(self.contained_type.pointer()).dereference() visualizer = gdb.default_visualizer(contained_value) super (StdVariantPrinter, self).__init__(contained_value, visualizer, 'array') diff --git a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc index 96be8c7..69c16c1 100644 --- a/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc +++ b/libstdc++-v3/testsuite/libstdc++-prettyprinters/cxx17.cc @@ -86,8 +86,6 @@ main() // { dg-final { note-test v3 {std::variant [index 1] = {3}} } } variant v4{ str }; // { dg-final { note-test v4 {std::variant [index 2] = {"string"}} } } - variant vref{str}; -// { dg-final { note-test vref {std::variant [index 0] = {"string"}} } } map m{ {1, "one"} }; map::node_type n0;