summaryrefslogtreecommitdiff
path: root/gcc/java
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/java')
-rw-r--r--gcc/java/ChangeLog10
-rw-r--r--gcc/java/gjavah.c7
-rw-r--r--gcc/java/lex.c4
-rw-r--r--gcc/java/lex.h18
-rw-r--r--gcc/java/mangle_name.c10
5 files changed, 23 insertions, 26 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog
index 7f8e1e3c472..33afaae0fa3 100644
--- a/gcc/java/ChangeLog
+++ b/gcc/java/ChangeLog
@@ -1,3 +1,13 @@
+2001-10-21 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
+ * gjavah.c (jni_print_char, decode_signature_piece): Use
+ safe-ctype macros and/or fold extra calls into fewer ones.
+ * lex.c (java_read_unicode, java_lex): Likewise.
+ * lex.h (JAVA_START_CHAR_P, JAVA_PART_CHAR_P, JAVA_ASCII_DIGIT,
+ JAVA_ASCII_HEXDIGIT, JAVA_ASCII_LETTER): Likewise.
+ * mangle_name.c (append_unicode_mangled_name,
+ unicode_mangling_length): Likewise.
+
2001-10-17 Richard Henderson <rth@redhat.com>
* Make-lang.in (java/lang.o): Depend on langhooks.h.
diff --git a/gcc/java/gjavah.c b/gcc/java/gjavah.c
index d340e66277e..d4de85b2545 100644
--- a/gcc/java/gjavah.c
+++ b/gcc/java/gjavah.c
@@ -287,9 +287,7 @@ jni_print_char (stream, ch)
fputs ("_3", stream);
else if (ch == '/')
fputs ("_", stream);
- else if ((ch >= '0' && ch <= '9')
- || (ch >= 'a' && ch <= 'z')
- || (ch >= 'A' && ch <= 'Z'))
+ else if (ISXDIGIT (ch))
fputc (ch, stream);
else
{
@@ -975,8 +973,7 @@ decode_signature_piece (stream, signature, limit, need_space)
array_loop:
for (signature++; (signature < limit
- && *signature >= '0'
- && *signature <= '9'); signature++)
+ && ISDIGIT (*signature)); signature++)
;
switch (*signature)
{
diff --git a/gcc/java/lex.c b/gcc/java/lex.c
index c2c4634a8a2..6422f9500d9 100644
--- a/gcc/java/lex.c
+++ b/gcc/java/lex.c
@@ -562,7 +562,7 @@ java_read_unicode (lex, unicode_escape_p)
{
if ((c = java_read_char (lex)) == UEOF)
return UEOF;
- if (c >= '0' && c <= '9')
+ if (ISDIGIT (c))
unicode |= (unicode_t)((c-'0') << shift);
else if ((c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'))
unicode |= (unicode_t)((10+(c | 0x20)-'a') << shift);
@@ -1058,7 +1058,7 @@ java_lex (java_lval)
{
/* We store in a string (in case it turns out to be a FP) and in
PARTS if we have to process a integer literal. */
- int numeric = (RANGE (c, '0', '9') ? c-'0' : 10 +(c|0x20)-'a');
+ int numeric = (ISDIGIT (c) ? c-'0' : 10 +(c|0x20)-'a');
int count;
/* Remember when we find a valid hexadecimal digit */
diff --git a/gcc/java/lex.h b/gcc/java/lex.h
index ef9e6e40174..a4589260cb3 100644
--- a/gcc/java/lex.h
+++ b/gcc/java/lex.h
@@ -250,33 +250,25 @@ extern void java_destroy_lexer PARAMS ((java_lexer *));
#define RANGE(c, l, h) (((c) >= l && (c) <= h))
#define JAVA_WHITE_SPACE_P(c) (c == ' ' || c == '\t' || c == '\f')
#define JAVA_START_CHAR_P(c) ((c < 128 \
- && (RANGE (c, 'A', 'Z') \
- || RANGE (c, 'a', 'z') \
- || c == '_' \
- || c == '$')) \
+ && (ISIDST (c) || c == '$')) \
|| (c >= 128 && java_start_char_p (c)))
#define JAVA_PART_CHAR_P(c) ((c < 128 \
- && (RANGE (c, 'A', 'Z') \
- || RANGE (c, 'a', 'z') \
- || RANGE (c, '0', '9') \
- || c == '_' \
+ && (ISIDNUM (c) \
|| c == '$' \
|| c == 0x0000 \
|| RANGE (c, 0x01, 0x08) \
|| RANGE (c, 0x0e, 0x1b) \
|| c == 0x7f)) \
|| (c >= 128 && java_part_char_p (c)))
-#define JAVA_ASCII_DIGIT(c) RANGE (c, '0', '9')
+#define JAVA_ASCII_DIGIT(c) ISDIGIT (c)
#define JAVA_ASCII_OCTDIGIT(c) RANGE (c, '0', '7')
-#define JAVA_ASCII_HEXDIGIT(c) (RANGE (c, '0', '9') || \
- RANGE (c, 'a', 'f') || \
- RANGE (c, 'A', 'F'))
+#define JAVA_ASCII_HEXDIGIT(c) ISXDIGIT (c)
#define JAVA_ASCII_FPCHAR(c) (RANGE (c, 'd', 'f') || RANGE (c, 'D', 'F') || \
c == '.' || JAVA_ASCII_DIGIT (c))
#define JAVA_FP_SUFFIX(c) (c == 'D' || c == 'd' || c == 'f' || c == 'F')
#define JAVA_FP_EXP(c) (c == 'E' || c == 'F')
#define JAVA_FP_PM(c) (c == '-' || c == '+')
-#define JAVA_ASCII_LETTER(c) (RANGE (c, 'a', 'z') || RANGE (c, 'A', 'Z'))
+#define JAVA_ASCII_LETTER(c) ISALPHA (c)
/* Constants */
#define JAVA_READ_BUFFER 256
diff --git a/gcc/java/mangle_name.c b/gcc/java/mangle_name.c
index 101dee7c7c2..4846db67c4c 100644
--- a/gcc/java/mangle_name.c
+++ b/gcc/java/mangle_name.c
@@ -87,12 +87,11 @@ append_unicode_mangled_name (name, len)
{
int ch = UTF8_GET(ptr, limit);
- if ((ch >= '0' && ch <= '9')
+ if ((ISALNUM (ch) && ch != 'U')
#ifndef NO_DOLLAR_IN_LABEL
|| ch == '$'
#endif
- || (ch >= 'a' && ch <= 'z')
- || (ch >= 'A' && ch <= 'Z' && ch != 'U'))
+ )
obstack_1grow (mangle_obstack, ch);
/* Everything else needs encoding */
else
@@ -149,12 +148,11 @@ unicode_mangling_length (name, len)
if (ch < 0)
error ("internal error - invalid Utf8 name");
- if ((ch >= '0' && ch <= '9')
+ if ((ISALNUM (ch) && ch != 'U')
#ifndef NO_DOLLAR_IN_LABEL
|| ch == '$'
#endif
- || (ch >= 'a' && ch <= 'z')
- || (ch >= 'A' && ch <= 'Z' && ch != 'U'))
+ )
num_chars++;
/* Everything else needs encoding */
else