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]

Re: [PATCH] Fix DEMANGLE_COMPONENT_TEMPLATE_ARGLIST demangling (PR other/43838)


On Wed, Jun 09, 2010 at 05:17:21PM -0700, Ian Lance Taylor wrote:
> Jakub Jelinek <jakub@redhat.com> writes:
> 
> > On Wed, Jun 09, 2010 at 01:03:08PM -0700, Ian Lance Taylor wrote:
> >> I suppose this is OK, but it seems simpler and cleaner to just check
> >> whether the d_print_comp will print anything before appending the
> >> comma.  It seems like it should work to do
> >> 
> >>     struct demangle_component *right = d_right (dc);
> >>     if (right != NULL && (d_left (right) != NULL || d_right (right) != NULL))
> >>       {
> >>         d_append_string (dpi, ", ");
> >>         d_print_comp (dpi, right);
> >>       }
> >
> > I believe e.g. DEMANGLE_COMPONENT_PACK_EXPANSION can print nothing
> > if d_find_pack returns non-NULL, but d_pack_length is 0.
> > Not sure if that's the only possibility.
> 
> I don't quite see how that can happen, but I don't have time to look
> into this, so I'll approve your patch.

E.g.:

cplus_demangle ("_Z1fIIEEviDpT_", DMGL_PARAMS)

With your patch it gives
void f<>(int, )
and with my patch (likewise for current libiberty)
void f<>(int)

right is != NULL, but d_left (right) != NULL too.  d_left (right)
is DEMANGLE_COMPONENT_PACK_EXPANSION with d_pack_length (d_find_pack ()) ==
0.

I guess we'd need to write a function like d_print_comp that would return
true if d_print_comp will actually print any characters if we wanted to
avoid this printing + undo.

	Jakub


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