diff options
author | obrien <obrien@FreeBSD.org> | 2002-10-11 06:01:20 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 2002-10-11 06:01:20 +0000 |
commit | aae950e69caf1dc3f308b74fe6d066a645a7ed09 (patch) | |
tree | fc657a1fb5e0ceeb952b5e5ad8744fec0332849c /contrib/binutils/libiberty/cplus-dem.c | |
parent | dcf134d53b2ddea66d0fe9fba4e8950a7c07b312 (diff) | |
download | FreeBSD-src-aae950e69caf1dc3f308b74fe6d066a645a7ed09.zip FreeBSD-src-aae950e69caf1dc3f308b74fe6d066a645a7ed09.tar.gz |
Import of Binutils from the FSF 2.13 branch (just pre-.1 release).
These bits are taken from the FSF anoncvs repo on 11-Oct-2002 22:39:35 PDT.
Diffstat (limited to 'contrib/binutils/libiberty/cplus-dem.c')
-rw-r--r-- | contrib/binutils/libiberty/cplus-dem.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/contrib/binutils/libiberty/cplus-dem.c b/contrib/binutils/libiberty/cplus-dem.c index 4e60b2c..203e30d 100644 --- a/contrib/binutils/libiberty/cplus-dem.c +++ b/contrib/binutils/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)++; @@ -2403,8 +2414,15 @@ demangle_arm_hp_template (work, mangled, n, declp) break; default: /* Not handling other HP cfront stuff */ - if (!do_type (work, &args, &arg)) - goto cfront_template_args_done; + { + const char* old_args = args; + if (!do_type (work, &args, &arg)) + goto cfront_template_args_done; + + /* Fail if we didn't make any progress: prevent infinite loop. */ + if (args == old_args) + return; + } } string_appends (declp, &arg); string_append (declp, ","); |