summaryrefslogtreecommitdiff
path: root/libiberty/cplus-dem.c
diff options
context:
space:
mode:
authorrodrigc <rodrigc@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-18 22:41:45 +0000
committerrodrigc <rodrigc@138bc75d-0d04-0410-961f-82ee72b054a4>2002-02-18 22:41:45 +0000
commita9e05c62438cf8d00ab6ee21419cfdba66154de9 (patch)
treef8f50d5ecbf383cb331c0237f66f0fea6ee36abf /libiberty/cplus-dem.c
parentad992f91562532d703b14c6858cbb51753fc0304 (diff)
downloadgcc-a9e05c62438cf8d00ab6ee21419cfdba66154de9.tar.gz
2002-02-18 Carlo Wood <carlo@gnu.org>
PR c++/5390 * cplus-dem.c (demangle_integral_value): Accept multi-digit numbers that do not start with an underscore; This is needed for integer template parameters. This doesn't break anything because multi-digit numbers are never followed by a digit. * testsuite/demangle-expected: Corrected all mangled test cases with multi-digit template parameters: g++ 2.95.x does not generate underscores around these parameters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49851 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libiberty/cplus-dem.c')
-rw-r--r--libiberty/cplus-dem.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c
index 4e60b2cfcbd..710b69d9c7a 100644
--- a/libiberty/cplus-dem.c
+++ b/libiberty/cplus-dem.c
@@ -1787,7 +1787,7 @@ demangle_integral_value (work, mangled, s)
/* By default, we let the number decide whether we shall consume an
underscore. */
- int consume_following_underscore = 0;
+ int multidigit_without_leading_underscore = 0;
int leave_following_underscore = 0;
success = 0;
@@ -1804,23 +1804,34 @@ demangle_integral_value (work, mangled, s)
`m'-prefix we must do it here, using consume_count and
adjusting underscores: we have to consume the underscore
matching the prepended one. */
- consume_following_underscore = 1;
+ multidigit_without_leading_underscore = 1;
string_appendn (s, "-", 1);
(*mangled) += 2;
}
else if (**mangled == '_')
{
/* Do not consume a following underscore;
- consume_following_underscore will consume what should be
+ multidigit_without_leading_underscore will consume what should be
consumed. */
leave_following_underscore = 1;
}
+ else
+ {
+ /* Since consume_count_with_underscores does not handle
+ multi-digit numbers that do not start with an underscore,
+ and this number can be an integer template parameter,
+ we have to call consume_count. */
+ multidigit_without_leading_underscore = 1;
+ /* These multi-digit numbers never end on an underscore,
+ so if there is one then don't eat it. */
+ leave_following_underscore = 1;
+ }
/* We must call consume_count if we expect to remove a trailing
underscore, since consume_count_with_underscores expects
the leading underscore (that we consumed) if it is to handle
multi-digit numbers. */
- if (consume_following_underscore)
+ if (multidigit_without_leading_underscore)
value = consume_count (mangled);
else
value = consume_count_with_underscores (mangled);
@@ -1838,7 +1849,7 @@ demangle_integral_value (work, mangled, s)
is wrong. If other (arbitrary) cases are followed by an
underscore, we need to do something more radical. */
- if ((value > 9 || consume_following_underscore)
+ if ((value > 9 || multidigit_without_leading_underscore)
&& ! leave_following_underscore
&& **mangled == '_')
(*mangled)++;