From patchwork Thu Jun 30 20:59:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 102835 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]) by ozlabs.org (Postfix) with SMTP id 439DBB6F53 for ; Fri, 1 Jul 2011 06:59:59 +1000 (EST) Received: (qmail 8118 invoked by alias); 30 Jun 2011 20:59:58 -0000 Received: (qmail 8108 invoked by uid 22791); 30 Jun 2011 20:59:57 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 30 Jun 2011 20:59:39 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p5UKxdSN024406 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 30 Jun 2011 16:59:39 -0400 Received: from host1.jankratochvil.net ([10.3.113.13]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p5UKxatm006640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 30 Jun 2011 16:59:38 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p5UKxYCG004145; Thu, 30 Jun 2011 22:59:34 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p5UKxX4U004133; Thu, 30 Jun 2011 22:59:33 +0200 Date: Thu, 30 Jun 2011 22:59:32 +0200 From: Jan Kratochvil To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Gabriel Dos Reis , gdb-patches@sourceware.org Subject: Re: [gcc patch] Re: C++ member function template id not matching linkage name (PR debug/49408) Message-ID: <20110630205932.GA1870@host1.jankratochvil.net> References: <20110627150431.GA24889@host1.jankratochvil.net> <4E08C538.2050001@redhat.com> <20110629200004.GA10065@host1.jankratochvil.net> <4E0B917A.7040508@redhat.com> <20110629210720.GA14840@host1.jankratochvil.net> <4E0BA6D3.8010503@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4E0BA6D3.8010503@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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 On Thu, 30 Jun 2011 00:27:31 +0200, Jason Merrill wrote: > The earlier output was correct. We just don't want to print "g(int, > double)". OK, understood now. It got more clear with the new testcase: _Z1tIlEDTplcvT_Li5EclL_Z1qsELi6EEEv decltype (((long)(5))+((q(short))(6))) t() -> decltype (((long)(5))+(q(6))) t() OK to check it in if the regression testing underway is OK? Thanks, Jan libiberty/ 2011-06-30 Jan Kratochvil * cp-demangle.c (d_print_comp): Suppress argument list for function references by the '&' unary operator. Keep also already processed variant without the argument list. Suppress argument list types for function call used in an expression. * testsuite/demangle-expected: Fix excessive argument list types in `test for typed function in decltype'. New testcase for no argument list types printed. 3 new testcases for function references by the '&' unary operator.. --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -4139,7 +4169,46 @@ d_print_comp (struct d_print_info *dpi, int options, return; case DEMANGLE_COMPONENT_UNARY: - if (d_left (dc)->type != DEMANGLE_COMPONENT_CAST) + if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR + && d_left (dc)->u.s_operator.op->len == 1 + && d_left (dc)->u.s_operator.op->name[0] == '&' + && d_right (dc)->type == DEMANGLE_COMPONENT_TYPED_NAME + && d_left (d_right (dc))->type == DEMANGLE_COMPONENT_QUAL_NAME + && d_right (d_right (dc))->type == DEMANGLE_COMPONENT_FUNCTION_TYPE) + { + /* Address of a function (therefore in an expression context) must + have its argument list suppressed. + + unary operator ... dc + operator & ... d_left (dc) + typed name ... d_right (dc) + qualified name ... d_left (d_right (dc)) + + function type ... d_right (d_right (dc)) + argument list + */ + + d_print_expr_op (dpi, options, d_left (dc)); + d_print_comp (dpi, options, d_left (d_right (dc))); + return; + } + else if (d_left (dc)->type == DEMANGLE_COMPONENT_OPERATOR + && d_left (dc)->u.s_operator.op->len == 1 + && d_left (dc)->u.s_operator.op->name[0] == '&' + && d_right (dc)->type == DEMANGLE_COMPONENT_QUAL_NAME) + { + /* Keep also already processed variant without the argument list. + + unary operator ... dc + operator & ... d_left (dc) + qualified name ... d_right (dc) + */ + + d_print_expr_op (dpi, options, d_left (dc)); + d_print_comp (dpi, options, d_right (dc)); + return; + } + else if (d_left (dc)->type != DEMANGLE_COMPONENT_CAST) d_print_expr_op (dpi, options, d_left (dc)); else { @@ -4165,7 +4234,21 @@ d_print_comp (struct d_print_info *dpi, int options, && d_left (dc)->u.s_operator.op->name[0] == '>') d_append_char (dpi, '('); - d_print_subexpr (dpi, options, d_left (d_right (dc))); + if (strcmp (d_left (dc)->u.s_operator.op->code, "cl") == 0 + && d_left (d_right (dc))->type == DEMANGLE_COMPONENT_TYPED_NAME) + { + /* Function call used in an expression should not have printed types + of the function arguments. Values of the function arguments still + get printed below. */ + + const struct demangle_component *func = d_left (d_right (dc)); + + if (d_right (func)->type != DEMANGLE_COMPONENT_FUNCTION_TYPE) + d_print_error (dpi); + d_print_subexpr (dpi, options, d_left (func)); + } + else + d_print_subexpr (dpi, options, d_left (d_right (dc))); if (strcmp (d_left (dc)->u.s_operator.op->code, "ix") == 0) { d_append_char (dpi, '['); --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -3920,7 +3920,11 @@ decltype (({parm#1}.(g))()) h, double>(A, double) # test for typed function in decltype --format=gnu-v3 _ZN1AIiE1jIiEEDTplfp_clL_Z1xvEEET_ -decltype ({parm#1}+((x())())) A::j(int) +decltype ({parm#1}+(x())) A::j(int) +# typed function in decltype with an argument list +--format=gnu-v3 +_Z1tIlEDTplcvT_Li5EclL_Z1qsELi6EEEv +decltype (((long)(5))+(q(6))) t() # test for expansion of function parameter pack --format=gnu-v3 _Z1gIIidEEDTclL_Z1fEspplfp_Li1EEEDpT_ @@ -3990,6 +3994,18 @@ outer(short (*)(int), long) _Z6outer2IsEPFilES1_ outer2(int (*)(long)) # +--format=gnu-v3 --no-params +_ZN1KIXadL_ZN1S1mEiEEE1fEv +K<&S::m>::f() +K<&S::m>::f +--format=gnu-v3 +_ZN1KILi1EXadL_ZN1S1mEiEEE1fEv +K<1, &S::m>::f() +# Here the `(int)' argument list of `S::m' is already removed. +--format=gnu-v3 +_ZN1KILi1EXadL_ZN1S1mEEEE1fEv +K<1, &S::m>::f() +# # Ada (GNAT) tests. # # Simple test.