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.kratoch...@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 via email to