From: DJ Delorie Date: Fri, 1 Feb 2002 01:34:09 +0000 (+0000) Subject: merge from gcc X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c78d91b126fd4414f0b590fde508961c5d7a1017;p=binutils-gdb.git merge from gcc --- diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ce63d84c78d..51518879e4f 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,7 @@ +2002-01-31 Phil Edwards + + * cp-demangle.c: Revert yesterday's change. + 2002-01-31 Adam Megacz * gcc/libiberty/configure.in: Treat mingw the same as cywin diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index a412e887851..457a09f4c19 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -938,8 +938,10 @@ static status_t demangle_discriminator PARAMS ((demangling_t, int)); static status_t cp_demangle PARAMS ((const char *, dyn_string_t, int)); +#ifdef IN_LIBGCC2 static status_t cp_demangle_type PARAMS ((const char*, dyn_string_t)); +#endif /* When passed to demangle_bare_function_type, indicates that the function's return type is not encoded before its parameter types. */ @@ -3531,13 +3533,14 @@ cp_demangle (name, result, style) dyn_string_t. On success, returns STATUS_OK. On failiure, returns an error message, and the contents of RESULT are unchanged. */ +#ifdef IN_LIBGCC2 static status_t cp_demangle_type (type_name, result) const char* type_name; dyn_string_t result; { status_t status; - demangling_t dm = demangling_new (type_name, 0); + demangling_t dm = demangling_new (type_name); if (dm == NULL) return STATUS_ALLOCATION_FAILED; @@ -3568,7 +3571,6 @@ cp_demangle_type (type_name, result) return status; } -#ifdef IN_LIBGCC2 extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *)); /* ia64 ABI-mandated entry point in the C++ runtime library for performing @@ -3691,15 +3693,14 @@ cplus_demangle_v3 (mangled) dyn_string_t demangled; status_t status; + /* If this isn't a mangled name, don't pretend to demangle it. */ + if (strncmp (mangled, "_Z", 2) != 0) + return NULL; + /* Create a dyn_string to hold the demangled name. */ demangled = dyn_string_new (0); /* Attempt the demangling. */ - if (mangled[0] == '_' && mangled[1] == 'Z') - /* Appears to be a function or variable name. */ - status = cp_demangle (mangled, demangled, 0); - else - /* Try to demangle it as the name of a type. */ - status = cp_demangle_type (mangled, demangled); + status = cp_demangle ((char *) mangled, demangled, 0); if (STATUS_NO_ERROR (status)) /* Demangling succeeded. */