Commit 46ab74b1 by Phil Edwards

cp-demangle.c (cp_demangle_type): Do not protect with IN_LIBGCC2.

2002-01-30  Phil Edwards  <pme@gcc.gnu.org>

	* cp-demangle.c (cp_demangle_type):  Do not protect with IN_LIBGCC2.
	(cplus_demangle_v3):  Mimic __cxa_demangle and fall back on
	cp_demangle_type.
	* testsuite/demangle-expected:  New gnu-v3 test.

From-SVN: r49353
parent 6169e5fd
2002-01-30 Phil Edwards <pme@gcc.gnu.org>
* cp-demangle.c (cp_demangle_type): Do not protect with IN_LIBGCC2.
(cplus_demangle_v3): Mimic __cxa_demangle and fall back on
cp_demangle_type.
* testsuite/demangle-expected: New gnu-v3 test.
2002-01-22 Momchil Velikov <velco@fadata.bg> 2002-01-22 Momchil Velikov <velco@fadata.bg>
* configure.in (variable detection): Use arrays of unspecified * configure.in (variable detection): Use arrays of unspecified
......
...@@ -938,10 +938,8 @@ static status_t demangle_discriminator ...@@ -938,10 +938,8 @@ static status_t demangle_discriminator
PARAMS ((demangling_t, int)); PARAMS ((demangling_t, int));
static status_t cp_demangle static status_t cp_demangle
PARAMS ((const char *, dyn_string_t, int)); PARAMS ((const char *, dyn_string_t, int));
#ifdef IN_LIBGCC2
static status_t cp_demangle_type static status_t cp_demangle_type
PARAMS ((const char*, dyn_string_t)); PARAMS ((const char*, dyn_string_t));
#endif
/* When passed to demangle_bare_function_type, indicates that the /* When passed to demangle_bare_function_type, indicates that the
function's return type is not encoded before its parameter types. */ function's return type is not encoded before its parameter types. */
...@@ -3533,14 +3531,13 @@ cp_demangle (name, result, style) ...@@ -3533,14 +3531,13 @@ cp_demangle (name, result, style)
dyn_string_t. On success, returns STATUS_OK. On failiure, returns dyn_string_t. On success, returns STATUS_OK. On failiure, returns
an error message, and the contents of RESULT are unchanged. */ an error message, and the contents of RESULT are unchanged. */
#ifdef IN_LIBGCC2
static status_t static status_t
cp_demangle_type (type_name, result) cp_demangle_type (type_name, result)
const char* type_name; const char* type_name;
dyn_string_t result; dyn_string_t result;
{ {
status_t status; status_t status;
demangling_t dm = demangling_new (type_name); demangling_t dm = demangling_new (type_name, 0);
if (dm == NULL) if (dm == NULL)
return STATUS_ALLOCATION_FAILED; return STATUS_ALLOCATION_FAILED;
...@@ -3571,6 +3568,7 @@ cp_demangle_type (type_name, result) ...@@ -3571,6 +3568,7 @@ cp_demangle_type (type_name, result)
return status; return status;
} }
#ifdef IN_LIBGCC2
extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *)); extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
/* ia64 ABI-mandated entry point in the C++ runtime library for performing /* ia64 ABI-mandated entry point in the C++ runtime library for performing
...@@ -3693,14 +3691,15 @@ cplus_demangle_v3 (mangled) ...@@ -3693,14 +3691,15 @@ cplus_demangle_v3 (mangled)
dyn_string_t demangled; dyn_string_t demangled;
status_t status; 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. */ /* Create a dyn_string to hold the demangled name. */
demangled = dyn_string_new (0); demangled = dyn_string_new (0);
/* Attempt the demangling. */ /* Attempt the demangling. */
status = cp_demangle ((char *) mangled, demangled, 0); 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);
if (STATUS_NO_ERROR (status)) if (STATUS_NO_ERROR (status))
/* Demangling succeeded. */ /* Demangling succeeded. */
......
...@@ -2590,3 +2590,7 @@ Prim.i(int, boolean, byte, double, float, char, java.lang.String, short, long) ...@@ -2590,3 +2590,7 @@ Prim.i(int, boolean, byte, double, float, char, java.lang.String, short, long)
--format=hp --format=hp
_Utf58_0_1__1_2147483647__2147483648 _Utf58_0_1__1_2147483647__2147483648
_Utf58_0_1__1_2147483647__2147483648 _Utf58_0_1__1_2147483647__2147483648
#
--format=gnu-v3
St9bad_alloc
std::bad_alloc
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment