public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
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
Date: Thu, 02 Jun 2011 14:17:00 -0000	[thread overview]
Message-ID: <20110602141707.GD15093@host1.jankratochvil.net> (raw)

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<short>(int (*)(long))int (*(int (*)(long)))(long)
exp: outer2<short>(int (*)(long))int (*)(long)


Thanks,
Jan


libiberty/
2011-05-24  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* cp-demangle.c (d_print_comp) <DEMANGLE_COMPONENT_FUNCTION_TYPE>:
	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<short>(int (*)(long)))(long)
+--format=gnu-v3 --ret-postfix
+_Z5outerIsEcPFilE
+outer<short>(int (*)(long))char
+--format=gnu-v3 --ret-postfix
+_Z5outerPFsiEl
+outer(short (*)(int), long)
+--format=gnu-v3 --ret-postfix
+_Z6outer2IsEPFilES1_
+outer2<short>(int (*)(long))int (*)(long)
 --format=gnu-v3 --ret-drop
 _Z5outerIsEcPFilE
 outer<short>(int (*)(long))

             reply	other threads:[~2011-06-02 14:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-02 14:17 Jan Kratochvil [this message]
2011-06-13 18:23 ` Ian Lance Taylor
2011-06-14  0:48   ` Jan Kratochvil

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=20110602141707.GD15093@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdb-patches@sourceware.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).