From patchwork Sun Aug 11 19:49:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Butcher X-Patchwork-Id: 266395 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 43FAA2C0091 for ; Mon, 12 Aug 2013 05:50:52 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=Xh1I7wEtm35VRuyd0o1BVe4BSUcMKFuc2qFQx9smxnAM1fO1HuTSC pJmVUo7SViSo6Z+FAeZ6l2vAoLCtgnRSEzG/4abLszcS/PiruhCyxk/EiKVw6rqi GBxXTHZP1X+iTmTUUO8pT/Er7JStnQacEQiEbvFtiFbrvKEVQFv6Eo= 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:from :to:cc:subject:date:message-id:in-reply-to:references; s= default; bh=pRbsuo3JrQS9zt06lFGnzvq+24o=; b=HQOAw9qOpdalp9Tihs3w cR+RVO60/nYCck+KmCiLUrnMTBCIinS9FpuKBPAXpP8QdDNGEl1fNbfJiOiq4rg6 8SvhtmD4bNwxBRnA5nj/2V20hAXtAx91D5g7UwWFOUQf2E4Xaj0NLy0o4ldk1pTY EzONxqAN4jJUY6K7nWkZqlk= Received: (qmail 19671 invoked by alias); 11 Aug 2013 19:50:10 -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 19620 invoked by uid 89); 11 Aug 2013 19:50:10 -0000 X-Spam-SWARE-Status: No, score=-3.5 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE, SPF_PASS autolearn=ham version=3.3.2 Received: from mail-ea0-f177.google.com (HELO mail-ea0-f177.google.com) (209.85.215.177) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sun, 11 Aug 2013 19:50:08 +0000 Received: by mail-ea0-f177.google.com with SMTP id f15so3028362eak.22 for ; Sun, 11 Aug 2013 12:50:06 -0700 (PDT) X-Received: by 10.15.54.67 with SMTP id s43mr22428032eew.133.1376250606544; Sun, 11 Aug 2013 12:50:06 -0700 (PDT) Received: from localhost.localdomain (munkyhouse.force9.co.uk. [84.92.244.81]) by mx.google.com with ESMTPSA id t6sm51008200eel.12.2013.08.11.12.50.05 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 11 Aug 2013 12:50:05 -0700 (PDT) From: Adam Butcher To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Gabriel Dos Reis , Andrew Sutton , Adam Butcher Subject: [PATCH 3/3] Support dumping type bindings in lambda diagnostics. Date: Sun, 11 Aug 2013 20:49:33 +0100 Message-Id: <1376250573-13753-4-git-send-email-adam@jessamine.co.uk> In-Reply-To: <1376250573-13753-1-git-send-email-adam@jessamine.co.uk> References: <1376250573-13753-1-git-send-email-adam@jessamine.co.uk> * error.c (dump_function_decl): Use standard diagnostic flow to dump a lambda diagnostic, albeit without stating the function name or duplicating the parameter spec (which is dumped as part of the type). --- gcc/cp/error.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 440169a..bd5f8cc 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1374,14 +1374,7 @@ dump_function_decl (tree t, int flags) int do_outer_scope = ! (flags & TFF_UNQUALIFIED_NAME); tree exceptions; vec *typenames = NULL; - - if (DECL_NAME (t) && LAMBDA_FUNCTION_P (t)) - { - /* A lambda's signature is essentially its "type", so defer. */ - gcc_assert (LAMBDA_TYPE_P (DECL_CONTEXT (t))); - dump_type (DECL_CONTEXT (t), flags); - return; - } + bool lambda_p = false; flags &= ~(TFF_UNQUALIFIED_NAME | TFF_TEMPLATE_NAME); if (TREE_CODE (t) == TEMPLATE_DECL) @@ -1443,16 +1436,23 @@ dump_function_decl (tree t, int flags) else if (cname) { dump_type (cname, flags); - pp_cxx_colon_colon (cxx_pp); + if (LAMBDA_TYPE_P (cname)) + lambda_p = true; + else + pp_cxx_colon_colon (cxx_pp); } else dump_scope (CP_DECL_CONTEXT (t), flags); - dump_function_name (t, flags); + /* A lambda's signature is essentially its "type", which has already been + dumped. */ + if (!lambda_p) + dump_function_name (t, flags); if (!(flags & TFF_NO_FUNCTION_ARGUMENTS)) { - dump_parameters (parmtypes, flags); + if (!lambda_p) + dump_parameters (parmtypes, flags); if (TREE_CODE (fntype) == METHOD_TYPE) {