aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3
diff options
context:
space:
mode:
authorcarlo <carlo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-02 14:29:26 +0000
committercarlo <carlo@138bc75d-0d04-0410-961f-82ee72b054a4>2003-10-02 14:29:26 +0000
commit4e3fcdacfc0e8cabbfdd720cee5ae23039edd1c3 (patch)
treeccaab9e68466ea77ca6dad097d61ff72be64ce38 /libstdc++-v3
parent06918680120269487c524b6f3b022ebd879e2a35 (diff)
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72027 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3')
-rw-r--r--libstdc++-v3/ChangeLog9
-rw-r--r--libstdc++-v3/include/bits/demangle.h10
-rw-r--r--libstdc++-v3/src/demangle.cc9
-rw-r--r--libstdc++-v3/testsuite/demangle/regression/cw-13.cc2
4 files changed, 17 insertions, 13 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 8a76c07f1dd..9abb29f0fd4 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -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
diff --git a/libstdc++-v3/include/bits/demangle.h b/libstdc++-v3/include/bits/demangle.h
index 9b1ff0fdb66..e5481b332cd 100644
--- a/libstdc++-v3/include/bits/demangle.h
+++ b/libstdc++-v3/include/bits/demangle.h
@@ -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;
diff --git a/libstdc++-v3/src/demangle.cc b/libstdc++-v3/src/demangle.cc
index 24d7009a623..fc5672bb0ed 100644
--- a/libstdc++-v3/src/demangle.cc
+++ b/libstdc++-v3/src/demangle.cc
@@ -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);
}
}
diff --git a/libstdc++-v3/testsuite/demangle/regression/cw-13.cc b/libstdc++-v3/testsuite/demangle/regression/cw-13.cc
index ec883be1de3..606eb9c257d 100644
--- a/libstdc++-v3/testsuite/demangle/regression/cw-13.cc
+++ b/libstdc++-v3/testsuite/demangle/regression/cw-13.cc
@@ -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;
}