From patchwork Thu Jun 2 14:17:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 98393 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 AFE17B6F71 for ; Fri, 3 Jun 2011 00:17:27 +1000 (EST) Received: (qmail 5887 invoked by alias); 2 Jun 2011 14:17:25 -0000 Received: (qmail 5875 invoked by uid 22791); 2 Jun 2011 14:17:24 -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, 02 Jun 2011 14:17:10 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p52EHABX026640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 2 Jun 2011 10:17:10 -0400 Received: from host1.jankratochvil.net (ovpn-113-38.phx2.redhat.com [10.3.113.38]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p52EH7lp000995 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 2 Jun 2011 10:17:09 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p52EH7G7024258; Thu, 2 Jun 2011 16:17:07 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p52EH7oe024257; Thu, 2 Jun 2011 16:17:07 +0200 Date: Thu, 2 Jun 2011 16:17:07 +0200 From: Jan Kratochvil To: gcc-patches@gcc.gnu.org Cc: gdb-patches@sourceware.org Subject: [gcc patch 3/3] cp-demangle.c: Fix DMGL_RET_POSTFIX for inner func types Message-ID: <20110602141707.GD15093@host1.jankratochvil.net> MIME-Version: 1.0 Content-Disposition: inline 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 Hi, I do not need this patch in any way but I believe it should go in for the case anyone would want to use DMGL_RET_POSTFIX with C/C++. Without this fix the new testcase would: FAIL at line 3979, options --format=gnu-v3 --ret-postfix: in: _Z6outer2IsEPFilES1_ out: outer2(int (*)(long))int (*(int (*)(long)))(long) exp: outer2(int (*)(long))int (*)(long) Thanks, Jan libiberty/ 2011-05-24 Jan Kratochvil * cp-demangle.c (d_print_comp) : Suppress d_print_mod for DMGL_RET_POSTFIX. * testsuite/demangle-expected: New testcases for --ret-postfix. --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -3921,7 +3921,10 @@ d_print_comp (struct d_print_info *dpi, const struct demangle_component *dc, options & ~(DMGL_RET_POSTFIX | DMGL_RET_DROP)); /* Print return type if present */ - if (d_left (dc) != NULL && (options & DMGL_RET_DROP) == 0) + if (d_left (dc) != NULL && (options & DMGL_RET_POSTFIX) != 0) + d_print_comp (dpi, d_left (dc), + options & ~(DMGL_RET_POSTFIX | DMGL_RET_DROP)); + else if (d_left (dc) != NULL && (options & DMGL_RET_DROP) == 0) { struct d_print_mod dpm; --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -3968,6 +3968,15 @@ outer(short (*)(int), long) --format=gnu-v3 _Z6outer2IsEPFilES1_ int (*outer2(int (*)(long)))(long) +--format=gnu-v3 --ret-postfix +_Z5outerIsEcPFilE +outer(int (*)(long))char +--format=gnu-v3 --ret-postfix +_Z5outerPFsiEl +outer(short (*)(int), long) +--format=gnu-v3 --ret-postfix +_Z6outer2IsEPFilES1_ +outer2(int (*)(long))int (*)(long) --format=gnu-v3 --ret-drop _Z5outerIsEcPFilE outer(int (*)(long))