OSDN Git Service

* safe-ctype.c: #include "ansidecl.h".
[pf3gnuchains/gcc-fork.git] / libiberty / cp-demangle.c
index a5e5ded..1cc4847 100644 (file)
@@ -1,4 +1,4 @@
-/* Demangler for IA64 / g++ standard C++ ABI.
+/* Demangler for IA64 / g++ V3 ABI.
    Copyright (C) 2000 Free Software Foundation, Inc.
    Written by Alex Samuel <samuel@codesourcery.com>. 
 
@@ -20,7 +20,7 @@
 */
 
 /* This file implements demangling of C++ names mangled according to
-   the IA64 / g++ standard C++ ABI.  Use the cp_demangle function to
+   the IA64 / g++ V3 ABI.  Use the cp_demangle function to
    demangle a mangled name, or compile with the preprocessor macro
    STANDALONE_DEMANGLER defined to create a demangling filter
    executable (functionally similar to c++filt, but includes this
@@ -3483,7 +3483,7 @@ cp_demangle_type (type_name, result)
 
 extern char *__cxa_demangle PARAMS ((const char *, char *, size_t *, int *));
 
-/* ABI-mandated entry point in the C++ runtime library for performing
+/* ia64 ABI-mandated entry point in the C++ runtime library for performing
    demangling.  MANGLED_NAME is a NUL-terminated character string
    containing the name to be demangled.  
 
@@ -3597,13 +3597,21 @@ __cxa_demangle (mangled_name, output_buffer, length, status)
    If the demangling failes, returns NULL.  */
 
 char *
-cplus_demangle_new_abi (mangled)
+cplus_demangle_v3 (mangled)
      const char* 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.  */
-  dyn_string_t demangled = dyn_string_new (0);
+  demangled = dyn_string_new (0);
   /* Attempt the demangling.  */
-  status_t status = cp_demangle ((char *) mangled, demangled);
+  status = cp_demangle ((char *) mangled, demangled);
+
   if (STATUS_NO_ERROR (status))
     /* Demangling succeeded.  */
     {