OSDN Git Service

* include/bits/demangle.h (demangle<Allocator>::symbol(char const*)):
authorcarlo <carlo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Oct 2003 14:29:26 +0000 (14:29 +0000)
committercarlo <carlo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Oct 2003 14:29:26 +0000 (14:29 +0000)
Decode symbols that start with _GLOBAL_[ID]_ differently: the
trailing part ends with a terminating zero and is not necessarily an
encoding.
* src/demangle.cc (): Same.
* testsuite/demangle/regression/cw-13.cc: Adjust for new output.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72027 138bc75d-0d04-0410-961f-82ee72b054a4

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/demangle.h
libstdc++-v3/src/demangle.cc
libstdc++-v3/testsuite/demangle/regression/cw-13.cc

index 8a76c07..9abb29f 100644 (file)
@@ -1,3 +1,12 @@
+2003-10-02  Carlo Wood  <carlo@alinoe.com>
+
+       * include/bits/demangle.h (demangle<Allocator>::symbol(char const*)):
+       Decode symbols that start with _GLOBAL_[ID]_ differently: the
+       trailing part ends with a terminating zero and is not necessarily an
+       encoding.
+       * src/demangle.cc (): Same.
+       * testsuite/demangle/regression/cw-13.cc: Adjust for new output.
+
 2003-10-02  Paolo Carlini  <pcarlini@unitus.it>
 
        * testsuite/22_locale/locale/cons/12438.cc: Use
index 9b1ff0f..e5481b3 100644 (file)
@@ -2293,7 +2293,7 @@ namespace __gnu_cxx
     demangle<Allocator>::symbol(char const* input)
     {
       // <mangled-name> ::= _Z <encoding>
-      // <mangled-name> ::= _GLOBAL_ _<type>_ _Z <encoding>            
+      // <mangled-name> ::= _GLOBAL_ _<type>_ <disambiguation part>
       //                    <type> can be I or D (GNU extension)
       typedef demangler::session<Allocator> demangler_type;
       string_type result;
@@ -2305,16 +2305,14 @@ namespace __gnu_cxx
        {
          if (!strncmp(input, "_GLOBAL__", 9)
              && (input[9] == 'D' || input[9] == 'I')
-             && input[10] == '_' && input[11] == '_' && input[12] == 'Z')
+             && input[10] == '_')
          {
            if (input[9] == 'D')
              result.assign("global destructors keyed to ", 28);
            else
              result.assign("global constructors keyed to ", 29);
-           int cnt = demangler_type::decode_encoding(result, input + 13,
-                                                     INT_MAX);
-           if (cnt < 0 || input[cnt + 13] != 0)
-             failure = true;
+           // Output the disambiguation part as-is.
+           result += input + 11;
          }
          else
            failure = true;
index 24d7009..fc5672b 100644 (file)
@@ -130,17 +130,14 @@ namespace __cxxabiv1
        // Possible _GLOBAL__ extension?
        if (!std::strncmp(mangled_name, "_GLOBAL__", 9) 
            && (mangled_name[9] == 'D' || mangled_name[9] == 'I')
-           && mangled_name[10] == '_' && mangled_name[11] == '_' 
-           && mangled_name[12] == 'Z')
+           && mangled_name[10] == '_')
        {
          if (mangled_name[9] == 'D')
            result.assign("global destructors keyed to ", 28);
          else
            result.assign("global constructors keyed to ", 29);
-         int cnt = session_type::
-             decode_encoding(result, mangled_name + 13, INT_MAX);
-         if (cnt < 0 || mangled_name[cnt + 13] != 0)
-           return failure(invalid_mangled_name, status);
+         // Output the disambiguation part as-is.
+         result += mangled_name + 11;
          return finish(result.data(), result.size(), buf, n, status);
        }
       }
index ec883be..606eb9c 100644 (file)
@@ -28,7 +28,7 @@ int main()
   using namespace __gnu_test;
 
   // cplus-dem CORE
-  verify_demangle("_GLOBAL__I__Z2fnv", "global constructors keyed to fn()");
+  verify_demangle("_GLOBAL__I__Z2fnv", "global constructors keyed to _Z2fnv");
 
   return 0;
 }