diff options
Diffstat (limited to 'libiberty')
-rw-r--r-- | libiberty/ChangeLog | 26 | ||||
-rw-r--r-- | libiberty/cp-demangle.c | 4 | ||||
-rw-r--r-- | libiberty/cplus-dem.c | 21 | ||||
-rw-r--r-- | libiberty/md5.c | 1 | ||||
-rw-r--r-- | libiberty/splay-tree.c | 68 | ||||
-rw-r--r-- | libiberty/testsuite/demangle-expected | 24 |
6 files changed, 141 insertions, 3 deletions
diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 597e840e0dc..bb91224f4af 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,29 @@ +2000-09-14 Hans-Peter Nilsson <hp@axis.com> + + * testsuite/demangle-expected: Add two tests for anonymous + namespaces. + * cplus-dem.c (gnu_special): Handle anonymous namespaces. + +2000-09-10 Mark Mitchell <mark@codesourcery.com> + + * splay-tree.c (splay_tree_predecessor): New function. + (splay_tree_successor): Likewise. + +2000-09-10 Hans-Peter Nilsson <hp@axis.com> + + * testsuite/demangle-expected: Add four tests for type_info + mangling. + * cplus-dem.c (gnu_special): Use do_type, not demangle_fund_type, + for a non-template non-qualified type_info function or node. + +2000-09-08 Alex Samuel <samuel@codesourcery.com> + + * cp-demangle.c: Fix copyright banner. + +2000-09-07 Michael Sokolov <msokolov@ivan.Harhan.ORG> + + * md5.c: #include "ansidecl.h". + 2000-09-06 Alex Samuel <samuel@codesourcery.com> * cp-demangle.c (status_allocation_failed): Rearrange whitespace. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 5b16c4e3507..e543edfd766 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -1,7 +1,9 @@ /* Demangler for IA64 / g++ standard C++ ABI. - Copyright (C) 2000 CodeSourcery LLC. + Copyright (C) 2000 Free Software Foundation, Inc. Written by Alex Samuel <samuel@codesourcery.com>. + This file is part of GNU CC. + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index e00f787e75c..3fe70b4030d 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -2811,6 +2811,25 @@ gnu_special (work, mangled, declp) success = 0; break; } + + if (n > 10 && strncmp (*mangled, "_GLOBAL_", 8) == 0 + && (*mangled)[9] == 'N' + && (*mangled)[8] == (*mangled)[10] + && strchr (cplus_markers, (*mangled)[8])) + { + /* A member of the anonymous namespace. There's information + about what identifier or filename it was keyed to, but + it's just there to make the mangled name unique; we just + step over it. */ + string_append (declp, "{anonymous}"); + (*mangled) += n; + + /* Now p points to the marker before the N, so we need to + update it to the first marker after what we consumed. */ + p = strpbrk (*mangled, cplus_markers); + break; + } + string_appendn (declp, *mangled, n); (*mangled) += n; } @@ -2872,7 +2891,7 @@ gnu_special (work, mangled, declp) success = demangle_template (work, mangled, declp, 0, 1, 1); break; default: - success = demangle_fund_type (work, mangled, declp); + success = do_type (work, mangled, declp); break; } if (success && **mangled != '\0') diff --git a/libiberty/md5.c b/libiberty/md5.c index d742c54f665..0c0507dfeb1 100644 --- a/libiberty/md5.c +++ b/libiberty/md5.c @@ -35,6 +35,7 @@ # endif #endif +#include "ansidecl.h" #include "md5.h" #ifdef _LIBC diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index de66d11bf56..9a684899d4a 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -1,5 +1,5 @@ /* A splay-tree datatype. - Copyright (C) 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc. Contributed by Mark Mitchell (mark@markmitchell.com). This file is part of GNU CC. @@ -366,6 +366,72 @@ splay_tree_lookup (sp, key) return 0; } +/* Return the immediate predecessor KEY, or NULL if there is no + predecessor. KEY need not be present in the tree. */ + +splay_tree_node +splay_tree_predecessor (sp, key) + splay_tree sp; + splay_tree_key key; +{ + int comparison; + splay_tree_node node; + + /* If the tree is empty, there is certainly no predecessor. */ + if (!sp->root) + return NULL; + + /* Splay the tree around KEY. That will leave either the KEY + itself, its predecessor, or its successor at the root. */ + splay_tree_splay (sp, key); + comparison = (*sp->comp)(sp->root->key, key); + + /* If the predecessor is at the root, just return it. */ + if (comparison < 0) + return sp->root; + + /* Otherwise, find the rightmost element of the left subtree. */ + node = sp->root->left; + if (node) + while (node->right) + node = node->right; + + return node; +} + +/* Return the immediate successor KEY, or NULL if there is no + predecessor. KEY need not be present in the tree. */ + +splay_tree_node +splay_tree_successor (sp, key) + splay_tree sp; + splay_tree_key key; +{ + int comparison; + splay_tree_node node; + + /* If the tree is empty, there is certainly no predecessor. */ + if (!sp->root) + return NULL; + + /* Splay the tree around KEY. That will leave either the KEY + itself, its predecessor, or its successor at the root. */ + splay_tree_splay (sp, key); + comparison = (*sp->comp)(sp->root->key, key); + + /* If the successor is at the root, just return it. */ + if (comparison > 0) + return sp->root; + + /* Otherwise, find the rightmost element of the left subtree. */ + node = sp->root->right; + if (node) + while (node->left) + node = node->left; + + return node; +} + /* Call FN, passing it the DATA, for every node in SP, following an in-order traversal. If FN every returns a non-zero value, the iteration ceases immediately, and the value is returned. diff --git a/libiberty/testsuite/demangle-expected b/libiberty/testsuite/demangle-expected index 0f947924a62..a5d72fab0fe 100644 --- a/libiberty/testsuite/demangle-expected +++ b/libiberty/testsuite/demangle-expected @@ -2542,3 +2542,27 @@ TA<int, N___A___<-99> >::foo__bar___foobar___(void) --format=gnu foo__bar___foobar_____t2TA2ZiZt4N__A1i9 TA<int, N__A<9> >::foo__bar___foobar___(void) +# +--format=gnu +__tfP8sockaddr +sockaddr * type_info function +# +--format=gnu +__tfPQ25libcwt16option_event_tct1Z12burst_app_ct +libcw::option_event_tct<burst_app_ct> * type_info function +# +--format=gnu +__tiP8sockaddr +sockaddr * type_info node +# +--format=gnu +__tiPQ25libcwt16option_event_tct1Z12burst_app_ct +libcw::option_event_tct<burst_app_ct> * type_info node +# +--format=gnu +_27_GLOBAL_.N.__12burst_app_ct.app_instance +{anonymous}::app_instance +# +--format=gnu +_26_GLOBAL_\$N\$_tmp_n.iilg4Gya\$app_instance +{anonymous}::app_instance |