OSDN Git Service

* c-format.c (maybe_read_dollar_number): Use safe-ctype macros
authorghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 21 Oct 2001 21:32:15 +0000 (21:32 +0000)
committerghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 21 Oct 2001 21:32:15 +0000 (21:32 +0000)
and/or fold extra calls into fewer ones.
* collect2.c (dump_file): Likewise.
* cppexp.c (parse_number): Likewise.
* cpplex.c (_cpp_lex_direct): Likewise.
* final.c (output_asm_insn, asm_fprintf): Likewise.
* fix-header.c (inf_scan_ident, main): Likewise.
* fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
Likewise.
* fold-const.c (real_hex_to_f): Likewise.
* gen-protos.c (parse_fn_proto): Likewise.
* genattrtab.c (check_attr_test, check_attr_value): Likewise.
* genrecog.c (change_state, write_action): Likewise.
* gensupport.c (shift_output_template): Likewise.
* local-alloc.c (requires_inout): Likewise.
* mips-tfile.c (IS_ASM_IDENT): Likewise.
* protoize.c (is_id_char, main): Likewise.
* real.c (asctoeg): Likewise.
* recog.c (asm_operand_ok): Likewise.
* reload.c (find_reloads): Likewise.
* scan.c (scan_identget_token): Likewise.
* sched-vis.c (print_value): Likewise.
* stringpool.c (ggc_alloc_string): Likewise.
* toplev.c (read_integral_parameter, decode_g_option): Likewise.
* tradcif.y (parse_number, yylex, parse_escape): Likewise.
* tradcpp.c (rescan): Likewise.
* tree.c (clean_symbol_name): Likewise.
* varasm.c (decode_reg_name): Likewise.

* alpha.h (ASM_OUTPUT_ASCII): Likewise.
* darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise.
* dsp16xx.h (ASM_OUTPUT_ASCII): Likewise.
* m88k.c (output_ascii): Likewise.
* m88k.h (OVERRIDE_OPTIONS): Likewise.
* mcore.h (REG_CLASS_FROM_LETTER): Likewise.
* ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
* sh.h (REG_CLASS_FROM_LETTER): Likewise.

cp:
* xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
extra calls into fewer ones.

f:
* bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra
calls into fewer ones.
* implic.c (ffeimplic_lookup_): Likewise.
* intdoc.c (dumpimp): Likewise.
* intrin.c (ffeintrin_init_0): Likewise.
* lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_):
Likewise.
* lex.h (ffelex_is_firstnamechar): Likewise.
* target.c (ffetarget_integerhex): Likewise.

java:
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46397 138bc75d-0d04-0410-961f-82ee72b054a4

50 files changed:
gcc/ChangeLog
gcc/c-format.c
gcc/collect2.c
gcc/config/alpha/alpha.h
gcc/config/darwin.c
gcc/config/dsp16xx/dsp16xx.h
gcc/config/m88k/m88k.c
gcc/config/m88k/m88k.h
gcc/config/mcore/mcore.h
gcc/config/ns32k/encore.h
gcc/config/sh/sh.h
gcc/cp/ChangeLog
gcc/cp/xref.c
gcc/cppexp.c
gcc/cpplex.c
gcc/f/ChangeLog
gcc/f/bad.c
gcc/f/implic.c
gcc/f/intdoc.c
gcc/f/intrin.c
gcc/f/lex.c
gcc/f/lex.h
gcc/f/target.c
gcc/final.c
gcc/fix-header.c
gcc/fixinc/fixfixes.c
gcc/fold-const.c
gcc/gen-protos.c
gcc/genattrtab.c
gcc/genrecog.c
gcc/gensupport.c
gcc/java/ChangeLog
gcc/java/gjavah.c
gcc/java/lex.c
gcc/java/lex.h
gcc/java/mangle_name.c
gcc/local-alloc.c
gcc/mips-tfile.c
gcc/protoize.c
gcc/real.c
gcc/recog.c
gcc/reload.c
gcc/scan.c
gcc/sched-vis.c
gcc/stringpool.c
gcc/toplev.c
gcc/tradcif.y
gcc/tradcpp.c
gcc/tree.c
gcc/varasm.c

index 009967f..d98daf8 100644 (file)
@@ -1,3 +1,43 @@
+2001-10-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * c-format.c (maybe_read_dollar_number): Use safe-ctype macros
+       and/or fold extra calls into fewer ones.
+       * collect2.c (dump_file): Likewise.
+       * cppexp.c (parse_number): Likewise.
+       * cpplex.c (_cpp_lex_direct): Likewise.
+       * final.c (output_asm_insn, asm_fprintf): Likewise.
+       * fix-header.c (inf_scan_ident, main): Likewise.
+       * fixinc/fixfixes.c (char_macro_use_fix, char_macro_def_fix):
+       Likewise.
+       * fold-const.c (real_hex_to_f): Likewise.
+       * gen-protos.c (parse_fn_proto): Likewise.
+       * genattrtab.c (check_attr_test, check_attr_value): Likewise.
+       * genrecog.c (change_state, write_action): Likewise.
+       * gensupport.c (shift_output_template): Likewise.
+       * local-alloc.c (requires_inout): Likewise.
+       * mips-tfile.c (IS_ASM_IDENT): Likewise.
+       * protoize.c (is_id_char, main): Likewise.
+       * real.c (asctoeg): Likewise.
+       * recog.c (asm_operand_ok): Likewise.
+       * reload.c (find_reloads): Likewise.
+       * scan.c (scan_identget_token): Likewise.
+       * sched-vis.c (print_value): Likewise.
+       * stringpool.c (ggc_alloc_string): Likewise.
+       * toplev.c (read_integral_parameter, decode_g_option): Likewise.
+       * tradcif.y (parse_number, yylex, parse_escape): Likewise.
+       * tradcpp.c (rescan): Likewise.
+       * tree.c (clean_symbol_name): Likewise.
+       * varasm.c (decode_reg_name): Likewise.
+
+       * alpha.h (ASM_OUTPUT_ASCII): Likewise.
+       * darwin.c (name_needs_quotes, func_name_maybe_scoped): Likewise.
+       * dsp16xx.h (ASM_OUTPUT_ASCII): Likewise.
+       * m88k.c (output_ascii): Likewise.
+       * m88k.h (OVERRIDE_OPTIONS): Likewise.
+       * mcore.h (REG_CLASS_FROM_LETTER): Likewise.
+       * ns32k/encore.h (ASM_OUTPUT_ASCII): Likewise.
+       * sh.h (REG_CLASS_FROM_LETTER): Likewise.
+
 2001-10-21  Neil Booth  <neil@daikokuya.demon.co.uk>
 
        * langhooks.c (lang_hook_default_do_nothing,
index 061ddb9..acf7806 100644 (file)
@@ -1092,7 +1092,7 @@ maybe_read_dollar_number (status, format, dollar_needed, params, param_ptr,
   int argnum;
   int overflow_flag;
   const char *fcp = *format;
-  if (*fcp < '0' || *fcp > '9')
+  if (! ISDIGIT (*fcp))
     {
       if (dollar_needed)
        {
@@ -1104,7 +1104,7 @@ maybe_read_dollar_number (status, format, dollar_needed, params, param_ptr,
     }
   argnum = 0;
   overflow_flag = 0;
-  while (*fcp >= '0' && *fcp <= '9')
+  while (ISDIGIT (*fcp))
     {
       int nargnum;
       nargnum = 10 * argnum + (*fcp - '0');
index c850608..6062f79 100644 (file)
@@ -502,7 +502,7 @@ dump_file (name)
     {
       int c;
       while (c = getc (stream),
-            c != EOF && (ISALNUM (c) || c == '_' || c == '$' || c == '.'))
+            c != EOF && (ISIDNUM (c) || c == '$' || c == '.'))
        obstack_1grow (&temporary_obstack, c);
       if (obstack_object_size (&temporary_obstack) > 0)
        {
index d8e4b04..e15e2ae 100644 (file)
@@ -2010,8 +2010,7 @@ do {                                              \
                 The VAX assembler fails to stop reading the escape           \
                 after three digits, so this is the only way we               \
                 can get it to parse the data properly.  */                   \
-             if (i < thissize - 1                                            \
-                 && p[i + 1] >= '0' && p[i + 1] <= '9')                      \
+             if (i < thissize - 1 && ISDIGIT (p[i + 1]))                     \
                _size_so_far = 0, fprintf (asm_out_file, "\"\n\t.ascii \"");  \
          }                                                                   \
        }                                                                     \
index 225a757..fe08528 100644 (file)
@@ -53,7 +53,7 @@ name_needs_quotes (name)
 {
   int c;
   while ((c = *name++) != '\0')
-    if (!isalnum (c) && c != '_')
+    if (! ISIDNUM (c))
       return 1;
   return 0;
 }
@@ -587,7 +587,7 @@ func_name_maybe_scoped (fname)
          while (*fname != 0)
            {
              if (fname[0] == '_' && fname[1] == '_'
-                 && (fname[2] == 'F' || (fname[2] >= '0' && fname[2] <= '9')))
+                 && (fname[2] == 'F' || ISDIGIT (fname[2])))
                return 0;
              ++fname;
            }
index 4ad062e..542c89b 100644 (file)
@@ -1699,8 +1699,7 @@ const_section ()                                                   \
                 The Vax assembler fails to stop reading the escape           \
                 after three digits, so this is the only way we               \
                 can get it to parse the data properly.                       \
-             if (i < thissize - 1                                            \
-                 && p[i + 1] >= '0' && p[i + 1] <= '9')                      \
+             if (i < thissize - 1 && ISDIGIT (p[i + 1]))                     \
                fprintf (asm_out_file, "\'\n\tint \'");                       \
                */ \
          }                                                                   \
index db5e069..4f596ad 100644 (file)
@@ -1662,7 +1662,7 @@ output_ascii (file, opcode, max, p, size)
          num += 2;
          in_escape = 0;
        }
-      else if (in_escape && c >= '0' && c <= '9')
+      else if (in_escape && ISDIGIT (c))
        {
          /* If a digit follows an octal-escape, the VAX assembler fails
             to stop reading the escape after three digits.  Continue to
index abcc050..def2743 100644 (file)
@@ -292,7 +292,7 @@ extern int flag_pic;                                /* -fpic */
       {                                                                             \
        const char *p = m88k_short_data;                                     \
        while (*p)                                                           \
-         if (*p >= '0' && *p <= '9')                                        \
+         if (ISDIGIT (*p))                                                  \
            p++;                                                             \
          else                                                               \
            {                                                                \
index cd3cd3a..d7b611b 100644 (file)
@@ -547,7 +547,7 @@ extern int regno_reg_class[];
 extern enum reg_class reg_class_from_letter[];
 
 #define REG_CLASS_FROM_LETTER(C) \
-   ( (C) >= 'a' && (C) <= 'z' ? reg_class_from_letter[(C) - 'a'] : NO_REGS )
+   ( ISLOWER (C) ? reg_class_from_letter[(C) - 'a'] : NO_REGS )
 
 /* The letters I, J, K, L, M, N, O, and P in a register constraint string
    can be used to stand for particular ranges of immediate operands.
index c11b3ff..e1337df 100644 (file)
@@ -144,8 +144,7 @@ do {                                                        \
       else                                             \
         {                                              \
           fprintf ((file), "\\%o", c);                 \
-          if (i < (size) - 1                           \
-              && (p)[i + 1] >= '0' && (p)[i + 1] <= '9')\
+          if (i < (size) - 1 && ISDIGIT ((p)[i + 1]))  \
           fprintf ((file), "\"\n\t.ascii \"");         \
         }                                              \
     }                                                  \
index 5ca89e0..ddbc2a7 100644 (file)
@@ -832,7 +832,7 @@ extern int regno_reg_class[];
 extern enum reg_class reg_class_from_letter[];
 
 #define REG_CLASS_FROM_LETTER(C) \
-   ( (C) >= 'a' && (C) <= 'z' ? reg_class_from_letter[(C)-'a'] : NO_REGS )
+   ( ISLOWER (C) ? reg_class_from_letter[(C)-'a'] : NO_REGS )
 \f
 /* The letters I, J, K, L and M in a register constraint string
    can be used to stand for particular ranges of immediate operands.
index 8a3f10b..a8bff6c 100644 (file)
@@ -1,3 +1,8 @@
+2001-10-21  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * xref.c (GNU_xref_member): Use safe-ctype macros and/or fold
+       extra calls into fewer ones.
+
 2001-10-18  Alexandre Oliva  <aoliva@redhat.com>
 
        * decl.c (duplicate_decls): Propagate DECL_UNINLINABLE.
index af35020..dd884db 100644 (file)
@@ -615,11 +615,11 @@ GNU_xref_member(cls, fld)
 #ifdef XREF_SHORT_MEMBER_NAMES
   for (p = &bufa[1]; *p != 0; ++p)
     {
-      if (p[0] == '_' && p[1] == '_' && p[2] >= '0' && p[2] <= '9') {
+      if (p[0] == '_' && p[1] == '_' && ISDIGIT (p[2])) {
        if (strncmp(&p[2], buf, i) == 0) *p = 0;
        break;
       }
-      else if (p[0] == '_' && p[1] == '_' && p[2] == 'C' && p[3] >= '0' && p[3] <= '9') {
+      else if (p[0] == '_' && p[1] == '_' && p[2] == 'C' && ISDIGIT (p[3])) {
        if (strncmp(&p[3], buf, i) == 0) *p = 0;
        break;
       }
index 040bf86..c7a00da 100644 (file)
@@ -129,7 +129,7 @@ parse_number (pfile, tok)
     {
       c = *p;
 
-      if (c >= '0' && c <= '9')
+      if (ISDIGIT (c))
        digit = c - '0';
       /* We believe that in all live character sets, a-f are
         consecutive, and so are A-F.  */
index 45ca635..a15fcca 100644 (file)
@@ -1183,7 +1183,7 @@ _cpp_lex_direct (pfile)
            buffer->cur = pos - 1;
        }
       /* All known character sets have 0...9 contiguous.  */
-      else if (c >= '0' && c <= '9')
+      else if (ISDIGIT (c))
        {
          result->type = CPP_NUMBER;
          parse_number (pfile, &result->val.str, c, 1);
index 14fb6c1..4e1335a 100644 (file)
@@ -1,3 +1,15 @@
+Sun Oct 21 17:28:17 2001  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * bad.c (ffebad_finish): Use safe-ctype macros and/or fold extra
+       calls into fewer ones.
+       * implic.c (ffeimplic_lookup_): Likewise.
+       * intdoc.c (dumpimp): Likewise.
+       * intrin.c (ffeintrin_init_0): Likewise.
+       * lex.c (ffelex_backslash_, ffelex_cfebackslash_, ffelex_hash_):
+       Likewise.
+       * lex.h (ffelex_is_firstnamechar): Likewise.
+       * target.c (ffetarget_integerhex): Likewise.
+
 2001-10-21  Craig Prescott  <prescott@phys.ufl.edu>
 
        * target.h (FFETARGET_32bit_longs): Don't define 
index 67eade0..d258648 100644 (file)
@@ -473,7 +473,7 @@ ffebad_finish ()
       if (c == '%')
        {
          c = ffebad_message_[++i];
-         if (ISALPHA (c) && ISUPPER (c))
+         if (ISUPPER (c))
            {
              index = c - 'A';
 
index 7e0c61b..625742f 100644 (file)
@@ -92,7 +92,7 @@ static ffeimplic_
 ffeimplic_lookup_ (unsigned char c)
 {
   /* NOTE: This is definitely ASCII-specific!!  */
-  if (ISALPHA (c) || (c == '_'))
+  if (ISIDST (c))
     return &ffeimplic_table_[c - 'A'];
   return NULL;
 }
index 44ab7a8..84720a3 100644 (file)
@@ -399,15 +399,12 @@ dumpimp (int menu, const char *name, const char *name_uc, size_t genno,
 
          for (c = summaries[imp]; c[0] != '\0'; ++c)
            {
-             if ((c[0] == '@')
-                 && (c[1] >= '0')
-             && (c[1] <= '9'))
+             if (c[0] == '@' && ISDIGIT (c[1]))
                {
                  int argno = c[1] - '0';
 
                  c += 2;
-                 while ((c[0] >= '0')
-                        && (c[0] <= '9'))
+                 while (ISDIGIT (c[0]))
                    {
                      argno = 10 * argno + (c[0] - '0');
                      ++c;
@@ -495,8 +492,7 @@ external procedure.\n\
       const char *arg_string;
       const char *arg_info;
 
-      if ((c[colon + 1] >= '0')
-         && (c[colon + 1] <= '9'))
+      if (ISDIGIT (c[colon + 1]))
        {
          other_arg = c[colon + 1] - '0';
          arg_string = argument_name_string (imp, other_arg);
@@ -548,9 +544,7 @@ this intrinsic is valid only when used as the argument to\n\
        printf (", the exact type being wide enough to hold a pointer\n\
 on the target system (typically @code{INTEGER(KIND=1)} or @code{INTEGER(KIND=4)}).\n\n");
 #endif
-      else if ((c[1] == '=')
-              && (c[colon + 1] >= '0')
-              && (c[colon + 1] <= '9'))
+      else if (c[1] == '=' && ISDIGIT (c[colon + 1]))
        {
          assert (other_arg >= 0);
 
@@ -1011,15 +1005,12 @@ Description:\n\
 
       while (c[0] != '\0')
        {
-         if ((c[0] == '@')
-             && (c[1] >= '0')
-         && (c[1] <= '9'))
+         if (c[0] == '@' && ISDIGIT (c[1]))
            {
              int argno = c[1] - '0';
 
              c += 2;
-             while ((c[0] >= '0')
-                    && (c[0] <= '9'))
+             while (ISDIGIT (c[0]))
                {
                  argno = 10 * argno + (c[0] - '0');
                  ++c;
index 6b89bfa..393706a 100644 (file)
@@ -1628,8 +1628,7 @@ ffeintrin_init_0 ()
        }
       if ((c[colon + 1] != '-')
          && (c[colon + 1] != '*')
-         && ((c[colon + 1] < '0')
-             || (c[colon + 1] > '9')))
+         && (! ISDIGIT (c[colon + 1])))
        {
          fprintf (stderr, "%s: bad COL-spec\n",
                   ffeintrin_imps_[i].name);
@@ -1683,9 +1682,9 @@ ffeintrin_init_0 ()
            }
          if (c[3] == '[')
            {
-             if (((c[4] < '0') || (c[4] > '9'))
+             if ((! ISDIGIT (c[4]))
                  || ((c[5] != ']')
-                     && (++c, (c[4] < '0') || (c[4] > '9')
+                     && (++c, ! ISDIGIT (c[4])
                          || (c[5] != ']'))))
                {
                  fprintf (stderr, "%s: bad arg-len\n",
@@ -1696,9 +1695,9 @@ ffeintrin_init_0 ()
            }
          if (c[3] == '(')
            {
-             if (((c[4] < '0') || (c[4] > '9'))
+             if ((! ISDIGIT (c[4]))
                  || ((c[5] != ')')
-                     && (++c, (c[4] < '0') || (c[4] > '9')
+                     && (++c, ! ISDIGIT (c[4])
                          || (c[5] != ')'))))
                {
                  fprintf (stderr, "%s: bad arg-rank\n",
index 9fef050..afdfd44 100644 (file)
@@ -394,16 +394,14 @@ ffelex_backslash_ (int c, ffewhereColumnNumber col)
       return c;
 
     case 2:
-      if ((c >= 'a' && c <= 'f')
-         || (c >= 'A' && c <= 'F')
-         || (c >= '0' && c <= '9'))
+      if (ISXDIGIT (c))
        {
          code *= 16;
          if (c >= 'a' && c <= 'f')
            code += c - 'a' + 10;
          if (c >= 'A' && c <= 'F')
            code += c - 'A' + 10;
-         if (c >= '0' && c <= '9')
+         if (ISDIGIT (c))
            code += c - '0';
          if (code != 0 || count != 0)
            {
@@ -599,9 +597,7 @@ ffelex_cfebackslash_ (int *use_d, int *d, FILE *finput)
       while (1)
        {
          c = getc (finput);
-         if (!(c >= 'a' && c <= 'f')
-             && !(c >= 'A' && c <= 'F')
-             && !(c >= '0' && c <= '9'))
+         if (! ISXDIGIT (c))
            {
              *use_d = 1;
              *d = c;
@@ -612,7 +608,7 @@ ffelex_cfebackslash_ (int *use_d, int *d, FILE *finput)
            code += c - 'a' + 10;
          if (c >= 'A' && c <= 'F')
            code += c - 'A' + 10;
-         if (c >= '0' && c <= '9')
+         if (ISDIGIT (c))
            code += c - '0';
          if (code != 0 || count != 0)
            {
@@ -1079,7 +1075,7 @@ ffelex_hash_ (FILE *finput)
      it and ignore it; otherwise, ignore the line, with an error
      if the word isn't `pragma', `ident', `define', or `undef'.  */
 
-  if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
+  if (ISALPHA(c))
     {
       if (c == 'p')
        {
index a28d0ac..04dfbed 100644 (file)
@@ -171,8 +171,7 @@ ffelexToken ffelex_token_use (ffelexToken t);
 #define ffelex_init_2()
 #define ffelex_init_3()
 #define ffelex_init_4()
-#define ffelex_is_firstnamechar(c) \
-  (ISALPHA ((c)) || ((c) == '_'))
+#define ffelex_is_firstnamechar(c) ISIDST (c)
 #define ffelex_terminate_0()
 #define ffelex_terminate_1()
 #define ffelex_terminate_2()
index b52e37f..7bda032 100644 (file)
@@ -1451,7 +1451,7 @@ ffetarget_integerhex (ffetargetIntegerDefault *val, ffelexToken integer)
        c = c - 'A' + 10;
       else if ((c >= 'a') && (c <= 'f'))
        c = c - 'a' + 10;
-      else if ((c >= '0') && (c <= '9'))
+      else if (ISDIGIT (c))
        c -= '0';
       else
        {
index ae3e473..cf62219 100644 (file)
@@ -3500,12 +3500,12 @@ output_asm_insn (template, operands)
           Letters `acln' are implemented directly.
           Other letters are passed to `output_operand' so that
           the PRINT_OPERAND macro can define them.  */
-       else if (ISLOWER (*p) || ISUPPER (*p))
+       else if (ISALPHA (*p))
          {
            int letter = *p++;
            c = atoi (p);
 
-           if (! (*p >= '0' && *p <= '9'))
+           if (! ISDIGIT (*p))
              output_operand_lossage ("operand number missing after %-letter");
            else if (this_is_asm_operands
                     && (c < 0 || (unsigned int) c >= insn_noperands))
@@ -3539,11 +3539,11 @@ output_asm_insn (template, operands)
              oporder[ops++] = c;
            opoutput[c] = 1;
 
-           while ((c = *p) >= '0' && c <= '9')
+           while (ISDIGIT (c = *p))
              p++;
          }
        /* % followed by a digit outputs an operand the default way.  */
-       else if (*p >= '0' && *p <= '9')
+       else if (ISDIGIT (*p))
          {
            c = atoi (p);
            if (this_is_asm_operands
@@ -3556,7 +3556,7 @@ output_asm_insn (template, operands)
              oporder[ops++] = c;
            opoutput[c] = 1;
 
-           while ((c = *p) >= '0' && c <= '9')
+           while (ISDIGIT (c = *p))
              p++;
          }
        /* % followed by punctuation: output something for that
@@ -3819,7 +3819,7 @@ asm_fprintf VPARAMS ((FILE *file, const char *p, ...))
       case '%':
        c = *p++;
        q = &buf[1];
-       while ((c >= '0' && c <= '9') || c == '.')
+       while (ISDIGIT (c) || c == '.')
          {
            *q++ = c;
            c = *p++;
index b197371..5ee5d95 100644 (file)
@@ -933,13 +933,13 @@ inf_scan_ident (s, c)
      int c;
 {
   s->ptr = s->base;
-  if (ISALPHA (c) || c == '_')
+  if (ISIDST (c))
     {
       for (;;)
        {
          SSTRING_PUT (s, c);
          c = INF_GET ();
-         if (c == EOF || !(ISALNUM (c) || c == '_'))
+         if (c == EOF || !(ISIDNUM (c)))
            break;
        }
     }
@@ -1250,7 +1250,7 @@ main (argc, argv)
          c = INF_GET ();
          if (c == EOF)
            break;
-         if (ISALPHA (c) || c == '_')
+         if (ISIDST (c))
            {
              c = inf_scan_ident (&buf, c);
              (void) INF_UNGET (c);
index a58c927..ad54960 100644 (file)
@@ -374,7 +374,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
        continue;
       if (!ISALPHA (*p))
        continue;
-      if (ISALNUM (p[1]) || p[1] == '_')
+      if (ISIDNUM (p[1]))
        continue;
 
       /* Splat all preceding text into the output buffer,
@@ -447,7 +447,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
            goto found;
          p++;
        }
-      while (ISALPHA (*p) || ISALNUM (*p) || *p == '_');
+      while (ISIDNUM (*p));
       /* Hit end of macro name without finding the string.  */
       continue;
 
@@ -461,7 +461,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
        continue;
       if (!ISALPHA (*p))
        continue;
-      if (ISALNUM (p[1]) || p[1] == '_')
+      if (ISIDNUM (p[1]))
        continue;
 
       /* The character at P is the one to look for in the following
index e25b67f..07184b9 100644 (file)
@@ -1127,8 +1127,7 @@ real_hex_to_f (s, mode)
   shcount = 0;
   while ((c = *p) != '\0')
     {
-      if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')
-         || (c >= 'a' && c <= 'f'))
+      if (ISXDIGIT (c))
        {
          k = c & CHARMASK;
          if (k >= 'a' && k <= 'f')
index 8e535b5..96aeef9 100644 (file)
@@ -109,7 +109,8 @@ parse_fn_proto (start, end, fn)
     }
   name_end = ptr+1;
 
-  while (ISALNUM ((unsigned char)*ptr) || *ptr == '_') --ptr;
+  while (ISIDNUM (*ptr))
+    --ptr;
   name_start = ptr+1;
   while (*ptr == ' ' || *ptr == '\t') ptr--;
   ptr[1] = 0;
index 4d19165..101a54b 100644 (file)
@@ -976,7 +976,7 @@ check_attr_test (exp, is_const, lineno)
          if (attr->is_numeric)
            {
              for (p = XSTR (exp, 1); *p; p++)
-               if (*p < '0' || *p > '9')
+               if (! ISDIGIT (*p))
                  fatal ("Attribute `%s' takes only numeric values",
                         XSTR (exp, 0));
            }
@@ -1112,7 +1112,7 @@ check_attr_value (exp, attr)
          if (attr && attr->negative_ok && *p == '-')
            p++;
          for (; *p; p++)
-           if (*p > '9' || *p < '0')
+           if (! ISDIGIT (*p))
              {
                message_with_line (attr ? attr->lineno : 0,
                                   "non-numeric value for numeric attribute %s",
index 4a3198b..b970c0a 100644 (file)
@@ -1725,17 +1725,17 @@ change_state (oldpos, newpos, afterward, indent)
 
   /* Hunt for the last [A-Z] in both strings.  */
   for (old_has_insn = odepth - 1; old_has_insn >= 0; --old_has_insn)
-    if (oldpos[old_has_insn] >= 'A' && oldpos[old_has_insn] <= 'Z')
+    if (ISUPPER (oldpos[old_has_insn]))
       break;
   for (new_has_insn = ndepth - 1; new_has_insn >= 0; --new_has_insn)
-    if (newpos[new_has_insn] >= 'A' && newpos[new_has_insn] <= 'Z')
+    if (ISUPPER (newpos[new_has_insn]))
       break;
 
   /* Go down to desired level.  */
   while (depth < ndepth)
     {
       /* It's a different insn from the first one.  */
-      if (newpos[depth] >= 'A' && newpos[depth] <= 'Z')
+      if (ISUPPER (newpos[depth]))
        {
          /* We can only fail if we're moving down the tree.  */
          if (old_has_insn >= 0 && oldpos[old_has_insn] >= newpos[depth])
@@ -1755,7 +1755,7 @@ change_state (oldpos, newpos, afterward, indent)
            }
          printf ("%sx%d = PATTERN (tem);\n", indent, depth + 1);
        }
-      else if (newpos[depth] >= 'a' && newpos[depth] <= 'z')
+      else if (ISLOWER (newpos[depth]))
        printf ("%sx%d = XVECEXP (x%d, 0, %d);\n",
                indent, depth + 1, depth, newpos[depth] - 'a');
       else
@@ -2129,7 +2129,7 @@ write_action (p, test, depth, uncond, success, subroutine_type)
            int match_len = 0, i;
 
            for (i = strlen (p->position) - 1; i >= 0; --i)
-             if (p->position[i] >= 'A' && p->position[i] <= 'Z')
+             if (ISUPPER (p->position[i]))
                {
                  match_len = p->position[i] - 'A';
                  break;
index e5ce347..a524571 100644 (file)
@@ -588,8 +588,7 @@ shift_output_template (new, old, disp)
          c = *old++;
          if (ISDIGIT ((unsigned char) c))
            c += disp;
-         else if (ISUPPER ((unsigned char) c)
-                  || ISLOWER ((unsigned char) c))
+         else if (ISALPHA (c))
            {
              *new++ = c;
              c = *old++ + disp;
index 7f8e1e3..33afaae 100644 (file)
@@ -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.
index d340e66..d4de85b 100644 (file)
@@ -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)
        {
index c2c4634..6422f95 100644 (file)
@@ -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 */
index ef9e6e4..a458926 100644 (file)
@@ -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
index 101dee7..4846db6 100644 (file)
@@ -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
index 22d7d48..b1856a5 100644 (file)
@@ -2432,7 +2432,7 @@ requires_inout (p)
       case '1':  case '2':  case '3':  case '4': case '5':
       case '6':  case '7':  case '8':  case '9':
        /* Skip the balance of the matching constraint.  */
-       while (*p >= '0' && *p <= '9')
+       while (ISDIGIT (*p))
          p++;
        break;
 
index ca03f26..9b2234a 100644 (file)
@@ -681,7 +681,7 @@ main ()
 #endif
 
 #define IS_ASM_IDENT(ch) \
-  (ISALNUM (ch) || (ch) == '_' || (ch) == '.' || (ch) == '$')
+  (ISIDNUM (ch) || (ch) == '.' || (ch) == '$')
 
 \f
 /* Redefinition of storage classes as an enumeration for better
index 001bf3b..cd67a5b 100644 (file)
@@ -716,7 +716,7 @@ static int
 is_id_char (ch)
      int ch;
 {
-  return (ISALNUM (ch) || (ch == '_') || (ch == '$'));
+  return (ISIDNUM (ch) || (ch == '$'));
 }
 
 /* Give a message indicating the proper way to invoke this program and then
@@ -4700,8 +4700,7 @@ main (argc, argv)
   {
     const char *cp;
 
-    for (cp = varargs_style_indicator;
-        ISALNUM ((const unsigned char)*cp) || *cp == '_'; cp++)
+    for (cp = varargs_style_indicator; ISIDNUM (*cp); cp++)
       continue;
     if (*cp != 0)
       varargs_style_indicator = savestring (varargs_style_indicator,
index 0cb2cdb..3c91606 100644 (file)
@@ -5190,7 +5190,7 @@ asctoeg (ss, y, oprec)
   trail = 0;
 
  nxtcom:
-  if (*s >= '0' && *s <= '9')
+  if (ISDIGIT (*s))
     k = *s - '0';
   else if (*s >= 'a' && *s <= 'f')
     k = 10 + *s - 'a';
@@ -5205,7 +5205,7 @@ asctoeg (ss, y, oprec)
       if ((trail == 0) && (decflg != 0))
        {
          sp = s;
-         while ((*sp >= '0' && *sp <= '9')
+         while (ISDIGIT (*sp)
                 || (base == 16 && ((*sp >= 'a' && *sp <= 'f')
                                    || (*sp >= 'A' && *sp <= 'F'))))
            ++sp;
@@ -5345,7 +5345,7 @@ read_expnt:
     }
   if (*s == '+')
     ++s;
-  while ((*s >= '0') && (*s <= '9'))
+  while (ISDIGIT (*s))
     {
       exp *= 10;
       exp += *s++ - '0';
index 874d567..1737ae5 100644 (file)
@@ -1657,7 +1657,7 @@ asm_operand_ok (op, constraint)
             proper matching constraint, but we can't actually fail
             the check if they didn't.  Indicate that results are
             inconclusive.  */
-         while (*constraint >= '0' && *constraint <= '9')
+         while (ISDIGIT (*constraint))
            constraint++;
          result = -1;
          break;
index 8b01ce2..2e8c93f 100644 (file)
@@ -2549,7 +2549,7 @@ find_reloads (insn, replace, ind_levels, live_known, reload_reg_p)
 
              commutative = i;
            }
-         else if (c >= '0' && c <= '9')
+         else if (ISDIGIT (c))
            {
              c = strtoul (p - 1, &p, 10);
 
index e9a9a4b..892daae 100644 (file)
@@ -63,13 +63,13 @@ scan_ident (fp, s, c)
      int c;
 {
   s->ptr = s->base;
-  if (ISALPHA(c) || c == '_')
+  if (ISIDST(c))
     {
       for (;;)
        {
          SSTRING_PUT(s, c);
          c = getc (fp);
-         if (c == EOF || !(ISALNUM(c) || c == '_'))
+         if (c == EOF || ! ISIDNUM(c))
            break;
        }
     }
@@ -222,7 +222,7 @@ get_token (fp, s)
       c = INT_TOKEN;
       goto done;
     }
-  if (ISALPHA (c) || c == '_')
+  if (ISIDST (c))
     {
       c = scan_ident (fp, s, c);
       ungetc (c, fp);
index 8949421..dbfbf26 100644 (file)
@@ -578,7 +578,7 @@ print_value (buf, x, verbose)
       if (REGNO (x) < FIRST_PSEUDO_REGISTER)
        {
          int c = reg_names[REGNO (x)][0];
-         if (c >= '0' && c <= '9')
+         if (ISDIGIT (c))
            cur = safe_concat (buf, cur, "%");
 
          cur = safe_concat (buf, cur, reg_names[REGNO (x)]);
index c28156c..b11651e 100644 (file)
@@ -86,7 +86,7 @@ ggc_alloc_string (contents, length)
 
   if (length == 0)
     return empty_string;
-  if (length == 1 && contents[0] >= '0' && contents[0] <= '9')
+  if (length == 1 && ISDIGIT (contents[0]))
     return digit_string (contents[0] - '0');
 
   obstack_grow0 (&string_stack, contents, length);
index b702a8f..ca77de7 100644 (file)
@@ -1590,7 +1590,7 @@ read_integral_parameter (p, pname, defval)
 
   while (*endp)
     {
-      if (*endp >= '0' && *endp <= '9')
+      if (ISDIGIT (*endp))
        endp++;
       else
        break;
@@ -4267,7 +4267,7 @@ decode_g_option (arg)
          enum debug_info_type type = da->debug_type;
          const char *p = arg + da_len;
 
-         if (*p && (*p < '0' || *p > '9'))
+         if (*p && ! ISDIGIT (*p))
            continue;
 
          /* A debug flag without a level defaults to level 2.
index 1f8eb28..167a8db 100644 (file)
@@ -246,9 +246,10 @@ parse_number (olen)
   while (len > 0) {
     c = *p++;
     len--;
-    if (c >= 'A' && c <= 'Z') c += 'a' - 'A';
+    if (ISUPPER (c))
+      c += 'a' - 'A';
 
-    if (c >= '0' && c <= '9') {
+    if (ISDIGIT (c)) {
       n *= base;
       n += c - '0';
     } else if (base == 16 && c >= 'a' && c <= 'f') {
@@ -396,7 +397,7 @@ yylex ()
     yyerror ("double quoted strings not allowed in #if expressions");
     return ERROR;
   }
-  if (c >= '0' && c <= '9') {
+  if (ISDIGIT (c)) {
     /* It's a number */
     for (namelen = 0;
         c = tokstart[namelen], is_idchar (c) || c == '.'; 
@@ -507,7 +508,7 @@ parse_escape (string_ptr)
        for (;;)
          {
            c = *(*string_ptr)++;
-           if (c >= '0' && c <= '9')
+           if (ISDIGIT (c))
              i = (i << 4) + c - '0';
            else if (c >= 'a' && c <= 'f')
              i = (i << 4) + c - 'a' + 10;
index 2c47a69..d4122c8 100644 (file)
@@ -1474,7 +1474,7 @@ do { ip = &instack[indepth];              \
            ibp += 2;
          }
          c = *ibp++;
-         if (!ISALNUM (c) && c != '.' && c != '_') {
+         if (! ISIDNUM (c) && c != '.') {
            --ibp;
            break;
          }
index a65bfb5..95d5cdc 100644 (file)
@@ -4489,15 +4489,14 @@ clean_symbol_name (p)
      char *p;
 {
   for (; *p; p++)
-    if (! (ISDIGIT(*p)
+    if (! (ISALNUM (*p)
 #ifndef NO_DOLLAR_IN_LABEL     /* this for `$'; unlikely, but... -- kr */
            || *p == '$'
 #endif
 #ifndef NO_DOT_IN_LABEL                /* this for `.'; unlikely, but...  */
            || *p == '.'
 #endif
-           || ISUPPER (*p)
-           || ISLOWER (*p)))
+          ))
       *p = '_';
 }
   
index 24c96cf..4d6f4b6 100644 (file)
@@ -758,7 +758,7 @@ decode_reg_name (asmspec)
 
       /* Allow a decimal number as a "register name".  */
       for (i = strlen (asmspec) - 1; i >= 0; i--)
-       if (! (asmspec[i] >= '0' && asmspec[i] <= '9'))
+       if (! ISDIGIT (asmspec[i]))
          break;
       if (asmspec[0] != 0 && i < 0)
        {