Commit 759fe240 by Ian Lance Taylor Committed by Ian Lance Taylor

re PR other/46332 (__cxa_demangle yields excess parentheses for function types)

libiberty/:
	PR other/46332
	* cp-demangle.c (d_print_function_type): Don't print parentheses
	if there are no modifiers to print.
	* testsuite/demangle-expected: Tweak one test case, add another.
libstdc++/:
	* testsuite/abi/demangle/abi_examples/14.cc (main): Change
	expected demangling.

From-SVN: r166695
parent 3c87e428
2010-11-12 Ian Lance Taylor <iant@google.com>
PR other/46332
* cp-demangle.c (d_print_function_type): Don't print parentheses
if there are no modifiers to print.
* testsuite/demangle-expected: Tweak one test case, add another.
2010-11-04 Richard Henderson <rth@redhat.com> 2010-11-04 Richard Henderson <rth@redhat.com>
* configure.ac (AC_CHECK_HEADERS): Add process.h. * configure.ac (AC_CHECK_HEADERS): Add process.h.
......
...@@ -4546,20 +4546,17 @@ d_print_function_type (struct d_print_info *dpi, ...@@ -4546,20 +4546,17 @@ d_print_function_type (struct d_print_info *dpi,
struct d_print_mod *mods) struct d_print_mod *mods)
{ {
int need_paren; int need_paren;
int saw_mod;
int need_space; int need_space;
struct d_print_mod *p; struct d_print_mod *p;
struct d_print_mod *hold_modifiers; struct d_print_mod *hold_modifiers;
need_paren = 0; need_paren = 0;
saw_mod = 0;
need_space = 0; need_space = 0;
for (p = mods; p != NULL; p = p->next) for (p = mods; p != NULL; p = p->next)
{ {
if (p->printed) if (p->printed)
break; break;
saw_mod = 1;
switch (p->mod->type) switch (p->mod->type)
{ {
case DEMANGLE_COMPONENT_POINTER: case DEMANGLE_COMPONENT_POINTER:
...@@ -4588,9 +4585,6 @@ d_print_function_type (struct d_print_info *dpi, ...@@ -4588,9 +4585,6 @@ d_print_function_type (struct d_print_info *dpi,
break; break;
} }
if (d_left (dc) != NULL && ! saw_mod)
need_paren = 1;
if (need_paren) if (need_paren)
{ {
if (! need_space) if (! need_space)
......
...@@ -3325,8 +3325,13 @@ first<Duo> ...@@ -3325,8 +3325,13 @@ first<Duo>
# #
--format=gnu-v3 --no-params --format=gnu-v3 --no-params
_Z3fooIiFvdEiEvv _Z3fooIiFvdEiEvv
void foo<int, void ()(double), int>() void foo<int, void (double), int>()
foo<int, void ()(double), int> foo<int, void (double), int>
#
--format=gnu-v3 --no-params
_Z1fIFvvEEvv
void f<void ()>()
f<void ()>
# #
--format=gnu-v3 --no-params --format=gnu-v3 --no-params
_ZN1N1fE _ZN1N1fE
......
2010-11-12 Ian Lance Taylor <iant@google.com>
PR other/46332
* testsuite/abi/demangle/abi_examples/14.cc (main): Change
expected demangling.
2010-11-11 Paolo Carlini <paolo.carlini@oracle.com> 2010-11-11 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/move.h (forward): Implement N3143, resolving US 90. * include/bits/move.h (forward): Implement N3143, resolving US 90.
......
...@@ -33,7 +33,7 @@ int main() ...@@ -33,7 +33,7 @@ int main()
template void foo<int, fun, int>(); template void foo<int, fun, int>();
*/ */
//demangle("_Z3fooIiPFidEiEvv", "void foo<int, int (*)(double), int>(void)"); //demangle("_Z3fooIiPFidEiEvv", "void foo<int, int (*)(double), int>(void)");
verify_demangle("_Z3fooIiFvdEiEvv", "void foo<int, void ()(double), int>()"); verify_demangle("_Z3fooIiFvdEiEvv", "void foo<int, void (double), int>()");
return 0; return 0;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment