This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH RFA: Bring demangler patch over to 2.21 branch


I would like to bring this patch over from mainline to the 2.21 branch,
to fix a demangler bug described at http://gcc.gnu.org/PR46332 .

OK for the branch?

Ian


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.


Index: libiberty/cp-demangle.c
===================================================================
RCS file: /cvs/src/src/libiberty/cp-demangle.c,v
retrieving revision 1.88
diff -u -r1.88 cp-demangle.c
--- libiberty/cp-demangle.c	10 Sep 2010 22:42:04 -0000	1.88
+++ libiberty/cp-demangle.c	15 Nov 2010 18:21:15 -0000
@@ -4546,20 +4546,17 @@
                        struct d_print_mod *mods)
 {
   int need_paren;
-  int saw_mod;
   int need_space;
   struct d_print_mod *p;
   struct d_print_mod *hold_modifiers;
 
   need_paren = 0;
-  saw_mod = 0;
   need_space = 0;
   for (p = mods; p != NULL; p = p->next)
     {
       if (p->printed)
 	break;
 
-      saw_mod = 1;
       switch (p->mod->type)
 	{
 	case DEMANGLE_COMPONENT_POINTER:
@@ -4588,9 +4585,6 @@
 	break;
     }
 
-  if (d_left (dc) != NULL && ! saw_mod)
-    need_paren = 1;
-
   if (need_paren)
     {
       if (! need_space)
Index: libiberty/testsuite/demangle-expected
===================================================================
RCS file: /cvs/src/src/libiberty/testsuite/demangle-expected,v
retrieving revision 1.53
diff -u -r1.53 demangle-expected
--- libiberty/testsuite/demangle-expected	27 Sep 2010 21:01:18 -0000	1.53
+++ libiberty/testsuite/demangle-expected	15 Nov 2010 18:21:16 -0000
@@ -3325,8 +3325,13 @@
 #
 --format=gnu-v3 --no-params
 _Z3fooIiFvdEiEvv
-void foo<int, void ()(double), int>()
-foo<int, void ()(double), int>
+void 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
 _ZN1N1fE

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]