Commit d74697b8 by H.J. Lu Committed by H.J. Lu

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

2002-02-02  H.J. Lu  (hjl@gnu.org)

	* cp-demangle.c (cp_demangle_type): Do not protect with
	IN_LIBGCC2.
	(cplus_demangle_v3_all): New.
	(cplus_demangle_v3): Call cplus_demangle_v3_all.
	(cplus_demangle_v3_type): Call cplus_demangle_v3_all.

	* cplus-dem.c (cplus_demangle_v3_p): New function pointer.
	Initialized to cplus_demangle_v3.
	(cplus_demangle_with_style): Call cplus_demangle_v3_p instead
	of cplus_demangle_v3.
	(main): Set cplus_demangle_v3_p to cplus_demangle_v3_type for
	command line symbol.

	* testsuite/regress-demangle: Pass the mangled name at the
	command line.

From-SVN: r49456
parent 4437e4d4
2002-02-02 H.J. Lu (hjl@gnu.org)
* cp-demangle.c (cp_demangle_type): Do not protect with
IN_LIBGCC2.
(cplus_demangle_v3_all): New.
(cplus_demangle_v3): Call cplus_demangle_v3_all.
(cplus_demangle_v3_type): Call cplus_demangle_v3_all.
* cplus-dem.c (cplus_demangle_v3_p): New function pointer.
Initialized to cplus_demangle_v3.
(cplus_demangle_with_style): Call cplus_demangle_v3_p instead
of cplus_demangle_v3.
(main): Set cplus_demangle_v3_p to cplus_demangle_v3_type for
command line symbol.
* testsuite/regress-demangle: Pass the mangled name at the
command line.
2002-02-01 H.J. Lu <hjl@gnu.org> 2002-02-01 H.J. Lu <hjl@gnu.org>
* cp-demangle.c (cp_demangle_type): Call demangling_new with * cp-demangle.c (cp_demangle_type): Call demangling_new with
......
...@@ -938,10 +938,10 @@ static status_t demangle_discriminator ...@@ -938,10 +938,10 @@ 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 static char* cplus_demangle_v3_all
PARAMS ((const char*, int));
/* 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,7 +3533,6 @@ cp_demangle (name, result, style) ...@@ -3533,7 +3533,6 @@ 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;
...@@ -3571,6 +3570,7 @@ cp_demangle_type (type_name, result) ...@@ -3571,6 +3570,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
...@@ -3690,17 +3690,43 @@ char * ...@@ -3690,17 +3690,43 @@ char *
cplus_demangle_v3 (mangled) cplus_demangle_v3 (mangled)
const char* mangled; const char* mangled;
{ {
return cplus_demangle_v3_all (mangled, 0);
}
char *
cplus_demangle_v3_type (mangled)
const char* mangled;
{
return cplus_demangle_v3_all (mangled, 1);
}
static char *
cplus_demangle_v3_all (mangled, type)
const char* mangled;
int type;
{
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 (mangled[0] == '_' && mangled[1] == 'Z')
if (strncmp (mangled, "_Z", 2) != 0) /* It is not a type. */
type = 0;
else
{
/* It is a type. Stop if we don't want to demangle types. */
if (!type)
return NULL; 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 (!type)
/* 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. */
......
...@@ -478,6 +478,9 @@ do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *) ...@@ -478,6 +478,9 @@ do_hpacc_template_literal PARAMS ((struct work_stuff *, const char **, string *)
static int static int
snarf_numeric_literal PARAMS ((const char **, string *)); snarf_numeric_literal PARAMS ((const char **, string *));
static char* (*cplus_demangle_v3_p) PARAMS ((const char* mangled))
= cplus_demangle_v3;
/* There is a TYPE_QUAL value for each type qualifier. They can be /* There is a TYPE_QUAL value for each type qualifier. They can be
combined by bitwise-or to form the complete set of qualifiers for a combined by bitwise-or to form the complete set of qualifiers for a
type. */ type. */
...@@ -911,7 +914,7 @@ cplus_demangle (mangled, options) ...@@ -911,7 +914,7 @@ cplus_demangle (mangled, options)
/* The V3 ABI demangling is implemented elsewhere. */ /* The V3 ABI demangling is implemented elsewhere. */
if (GNU_V3_DEMANGLING || AUTO_DEMANGLING) if (GNU_V3_DEMANGLING || AUTO_DEMANGLING)
{ {
ret = cplus_demangle_v3 (mangled); ret = cplus_demangle_v3_p (mangled);
if (ret || GNU_V3_DEMANGLING) if (ret || GNU_V3_DEMANGLING)
return ret; return ret;
} }
...@@ -5086,6 +5089,7 @@ main (argc, argv) ...@@ -5086,6 +5089,7 @@ main (argc, argv)
if (optind < argc) if (optind < argc)
{ {
cplus_demangle_v3_p = cplus_demangle_v3_type;
for ( ; optind < argc; optind++) for ( ; optind < argc; optind++)
{ {
demangle_it (argv[optind]); demangle_it (argv[optind]);
......
...@@ -10,7 +10,7 @@ sed -e '/^#/ d' "$1" | ( ...@@ -10,7 +10,7 @@ sed -e '/^#/ d' "$1" | (
read mangled read mangled
read demangled read demangled
x="`echo $mangled | ./test-filter $type`" x="`./test-filter $type $mangled`"
count=`expr $count + 1` count=`expr $count + 1`
if test "x$x" != "x$demangled"; then if test "x$x" != "x$demangled"; then
failures=`expr $failures + 1` failures=`expr $failures + 1`
......
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