aboutsummaryrefslogtreecommitdiff
path: root/gcc/java/class.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-11-04 04:56:25 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-11-04 04:56:25 +0000
commit0160fbe1508e18e4ff7b50822b3620f69cffe400 (patch)
treeb9112af0216cc95c9d4df1196c09dc07277d8cf7 /gcc/java/class.c
parentf132f529e0f604f68eef0aa780b86dabeb00d964 (diff)
downloadgcc-0160fbe1508e18e4ff7b50822b3620f69cffe400.zip
gcc-0160fbe1508e18e4ff7b50822b3620f69cffe400.tar.gz
gcc-0160fbe1508e18e4ff7b50822b3620f69cffe400.tar.bz2
class.c (cxx_keyword_p): Accept keywords with trailing `$'s.
* class.c (cxx_keyword_p): Accept keywords with trailing `$'s. * gjavah.c (cxx_keyword_subst): Handle any number of trailing `$'. From-SVN: r37243
Diffstat (limited to 'gcc/java/class.c')
-rw-r--r--gcc/java/class.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/java/class.c b/gcc/java/class.c
index 1b18497..00cf42e 100644
--- a/gcc/java/class.c
+++ b/gcc/java/class.c
@@ -1961,11 +1961,23 @@ cxx_keyword_p (name, length)
mid != old;
old = mid, mid = (last + first) / 2)
{
- int r = utf8_cmp (name, length, cxx_keywords[mid]);
+ int kwl = strlen (cxx_keywords[mid]);
+ int min_length = kwl > length ? length : kwl;
+ int r = utf8_cmp (name, min_length, cxx_keywords[mid]);
if (r == 0)
- return 1;
- else if (r < 0)
+ {
+ int i;
+ /* We've found a match if all the remaining characters are
+ `$'. */
+ for (i = min_length; i < length && name[i] == '$'; ++i)
+ ;
+ if (i == length)
+ return 1;
+ r = 1;
+ }
+
+ if (r < 0)
last = mid;
else
first = mid;