This is the mail archive of the mailing list for the GCC project.

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

cp_demangle interface

Currently, cp_demangle returns success if either:

  1) The input string is a valid V3 mangled name, or
  2) It doesn't start with _Z.

But if it does start with _Z, and yet is not a valid V3 mangled name, it
gives an error.  This seems like an odd interface to me; I would expect it
to treat all strings which are not valid mangled names identically.  This
broke my first AUTO_DEMANGLING patch to cplus-dem.c because I assumed that
calling cplus_demangle_v3 on an invalid name would return NULL; testing
showed this to be false (shame on me), so I fixed that in cplus_demangle_v3
with my patch today.  But it seems to me that cp_demangle ought to behave

Looking at the ia64 ABI document, I see that this oddity is also in the ABI
spec; looks like it went in after the August 31 meeting, after you raised
the question of what __cxa_demangle should do with input of "i".  The draft
states, ambiguously, that an ambiguity between user names and builtin names
should be resolved in favor of user names.  Which doesn't tell us anything
about what to do with "5Class".  IMO, the resolution is bogus, and your
implementation is right; anything which doesn't start with _Z should be
treated as a type name.  Anything which isn't a valid type mangling is
rejected.  This would include extern "C" names; I suggest that we simply
shouldn't feed them to __cxa_demangle.

Similarly, I think that cp_demangle should return an error on input that
doesn't start with _Z.



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