[3/3] cp-demangle.c: Fix DMGL_RET_POSTFIX for inner func types
diff mbox

Message ID 20110602141707.GD15093@host1.jankratochvil.net
State New
Headers show

Commit Message

Jan Kratochvil June 2, 2011, 2:17 p.m. UTC
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.

Comments

Ian Taylor June 13, 2011, 6:09 p.m. UTC | #1
On Thu, Jun 2, 2011 at 7:17 AM, Jan Kratochvil
<jan.kratochvil@redhat.com> wrote:
>
> 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.

This is OK.

Thanks.

Ian
Jan Kratochvil June 13, 2011, 10:37 p.m. UTC | #2
On Mon, 13 Jun 2011 20:09:57 +0200, Ian Lance Taylor wrote:
> On Thu, Jun 2, 2011 at 7:17 AM, Jan Kratochvil
> <jan.kratochvil@redhat.com> wrote:
> >
> > 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.
> 
> This is OK.

Checked in:
	http://gcc.gnu.org/viewcvs?view=revision&revision=175001


Thanks,
Jan

Patch
diff mbox

--- 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))