This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)
- From: Jason Merrill <jason at redhat dot com>
- To: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Cc: Keith Seitz <keiths at redhat dot com>
- Date: Tue, 10 Jan 2012 12:03:44 -0500
- Subject: Re: C++/libiberty PATCH for many mangling fixes (6057, 48051, 50855, 51322 and more)
- References: <4F0769D4.2070802@redhat.com>
Keith pointed out that my demangler changes changed the demangling of
overloaded operator delete; this patch corrects that.
Tested x86_64-pc-linux-gnu, applying to trunk.
commit ee8af40f38391d44549cf96b159dcb00821c2074
Author: Jason Merrill <jason@redhat.com>
Date: Tue Jan 10 11:16:46 2012 -0500
* cp-demangle.c (d_print_comp) [DEMANGLE_COMPONENT_OPERATOR]:
Omit a trailing space in the operator name.
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 2dfd67c..18b84a1 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -4357,14 +4357,17 @@ d_print_comp (struct d_print_info *dpi, int options,
case DEMANGLE_COMPONENT_OPERATOR:
{
- char c;
+ const struct demangle_operator_info *op = dc->u.s_operator.op;
+ int len = op->len;
d_append_string (dpi, "operator");
- c = dc->u.s_operator.op->name[0];
- if (IS_LOWER (c))
+ /* Add a space before new/delete. */
+ if (IS_LOWER (op->name[0]))
d_append_char (dpi, ' ');
- d_append_buffer (dpi, dc->u.s_operator.op->name,
- dc->u.s_operator.op->len);
+ /* Omit a trailing space. */
+ if (op->name[len-1] == ' ')
+ --len;
+ d_append_buffer (dpi, op->name, len);
return;
}
diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected
index 3f3960a..408c4f4 100644
--- a/libiberty/testsuite/demangle-expected
+++ b/libiberty/testsuite/demangle-expected
@@ -4058,6 +4058,9 @@ decltype ((::delete {parm#1}),(+{parm#1})) f<int>(int*)
_Z1fIiEDTcmdafp_psfp_EPT_
decltype ((delete[] {parm#1}),(+{parm#1})) f<int>(int*)
--format=gnu-v3
+_ZN1AdlEPv
+A::operator delete(void*)
+--format=gnu-v3
_Z2f1IiEDTppfp_ET_
decltype ({parm#1}++) f1<int>(int)
--format=gnu-v3