]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
system.h (CTYPE_CONV, [...]): New macros.
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Thu, 16 Sep 1999 22:20:44 +0000 (22:20 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Thu, 16 Sep 1999 22:20:44 +0000 (22:20 +0000)
* system.h (CTYPE_CONV, TOUPPER, TOLOWER): New macros.  Use
CTYPE_CONV in all ctype macros.

* cccp.c (initialize_char_syntax): Use uppercase ctype macro
from system.h.

* cexp.y (initialize_random_junk): Likewise.

* c4x.c (c4x_interrupt_function_p, c4x_handle_pragma): Likewise.

* i370.c (handle_pragma): Likewise.

* i370.h (ASM_OUTPUT_LABELREF, ASM_OUTPUT_ASCII): Likewise.

* v850.c (override_options): Likewise.

* doprint.c (_doprnt): Likewise.

* fixinc/fixincl.c (main, quoted_file_exists, extract_quoted_files):
Likewise.

* fixinc/server.c (load_data): Likewise.

* fold-const.c (real_hex_to_f): Likewise.

* genattr.c (write_upcase, gen_attr): Likewise.

* genattrtab.c (convert_const_symbol_ref, evaluate_eq_attr,
write_upcase): Likewise.

* genemit.c (print_code): Likewise.

* genopinit.c (gen_insn): Likewise.

* genpeep.c (print_code): Likewise.

* genrecog.c (print_code): Likewise.

* optabs.c (init_libfuncs): Likewise.

ch:

* lex.c (maybe_downcase, getlc, handle_generic_pragma,
check_newline): Likewise.

f:

* bad.c (ffebad_finish): Likewise.

* fini.c (main): Likewise.

* intrin.c (ffeintrin_init_0): Likewise.

* lex.c (ffelex_hash_): Likewise.

* src.c (ffesrc_init_1): Likewise.

From-SVN: r29463

28 files changed:
gcc/ChangeLog
gcc/cccp.c
gcc/cexp.c
gcc/cexp.y
gcc/ch/ChangeLog
gcc/ch/lex.c
gcc/config/c4x/c4x.c
gcc/config/i370/i370.c
gcc/config/i370/i370.h
gcc/config/v850/v850.c
gcc/doprint.c
gcc/f/ChangeLog
gcc/f/bad.c
gcc/f/fini.c
gcc/f/intrin.c
gcc/f/lex.c
gcc/f/src.c
gcc/fixinc/fixincl.c
gcc/fixinc/server.c
gcc/fold-const.c
gcc/genattr.c
gcc/genattrtab.c
gcc/genemit.c
gcc/genopinit.c
gcc/genpeep.c
gcc/genrecog.c
gcc/optabs.c
gcc/system.h

index 716ea42195fe17f3ada09ea73779c4efb874b434..3b9615e4d4690e24f980cddf05d50362200721e1 100644 (file)
@@ -1,3 +1,45 @@
+Thu Sep 16 18:06:35 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * system.h (CTYPE_CONV, TOUPPER, TOLOWER): New macros.  Use
+       CTYPE_CONV in all ctype macros.
+
+       * cccp.c (initialize_char_syntax): Use uppercase ctype macro
+       from system.h.
+
+       * cexp.y (initialize_random_junk): Likewise.
+
+       * c4x.c (c4x_interrupt_function_p, c4x_handle_pragma): Likewise.
+
+       * i370.c (handle_pragma): Likewise.
+
+       * i370.h (ASM_OUTPUT_LABELREF, ASM_OUTPUT_ASCII): Likewise.
+
+       * v850.c (override_options): Likewise.
+
+       * doprint.c (_doprnt): Likewise.
+
+       * fixinc/fixincl.c (main, quoted_file_exists, extract_quoted_files):
+       Likewise.
+
+       * fixinc/server.c (load_data): Likewise.
+
+       * fold-const.c (real_hex_to_f): Likewise.
+
+       * genattr.c (write_upcase, gen_attr): Likewise.
+
+       * genattrtab.c (convert_const_symbol_ref, evaluate_eq_attr,
+       write_upcase): Likewise.
+
+       * genemit.c (print_code): Likewise.
+
+       * genopinit.c (gen_insn): Likewise.
+
+       * genpeep.c (print_code): Likewise.
+
+       * genrecog.c (print_code): Likewise.
+
+       * optabs.c (init_libfuncs): Likewise.
+
 Thu Sep 16 14:03:32 1999  Mark Mitchell  <mark@codesourcery.com>
 
        * haifa-sched.c (sched_analyze): Keep the list of notes organized
index 16def7a583b6126cdb0d69c9805aa9ac7214005f..4a906486bcd7415303b2b0b6b0da8a3aec9a0435 100644 (file)
@@ -10131,9 +10131,9 @@ initialize_char_syntax ()
    * refer to them.
    */
   for (i = 'a'; i <= 'z'; i++) {
-    is_idchar[toupper(i)] = 1;
+    is_idchar[TOUPPER(i)] = 1;
     is_idchar[i] = 1;
-    is_idstart[toupper(i)] = 1;
+    is_idstart[TOUPPER(i)] = 1;
     is_idstart[i] = 1;
   }
   for (i = '0'; i <= '9'; i++)
index 82fcc795765a6e9c26b57bed2a26ffa75883beec..fc4d7fce8610c644c7bb7f62674f817f114fb0d4 100644 (file)
@@ -2029,9 +2029,9 @@ initialize_random_junk ()
    * refer to them.
    */
   for (i = 'a'; i <= 'z'; i++) {
-    ++is_idchar[toupper(i)];
+    ++is_idchar[TOUPPER(i)];
     ++is_idchar[i];
-    ++is_idstart[toupper(i)];
+    ++is_idstart[TOUPPER(i)];
     ++is_idstart[i];
   }
   for (i = '0'; i <= '9'; i++)
index e7372aa3ac8698f5ff27571696e4e4dff699d817..410f671fbb9860a6a0dc280b1f11ea5ea374727c 100644 (file)
@@ -1113,9 +1113,9 @@ initialize_random_junk ()
    * refer to them.
    */
   for (i = 'a'; i <= 'z'; i++) {
-    ++is_idchar[toupper(i)];
+    ++is_idchar[TOUPPER(i)];
     ++is_idchar[i];
-    ++is_idstart[toupper(i)];
+    ++is_idstart[TOUPPER(i)];
     ++is_idstart[i];
   }
   for (i = '0'; i <= '9'; i++)
index a39ab98c7e23662d06937c2b89f029a1c7db92d4..8ab5497315334b282e79f7f7a42400171527c537 100644 (file)
@@ -1,3 +1,8 @@
+1999-09-16  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * lex.c (maybe_downcase, getlc, handle_generic_pragma,
+       check_newline): Use uppercase ctype macro from system.h.
+
 1999-09-15  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * actions.c (warn_unhandled): Use xstrdup, not xmalloc/strcpy.
index b7fe5f4665fef9560b2b0a249f170f83dc5f3c3f..44029b99d209b1cce9832d2367f9ae7f6aec1e25 100644 (file)
@@ -888,7 +888,7 @@ maybe_downcase (str)
   while (*str)
     {
       if (ISUPPER ((unsigned char) *str))
-       *str = tolower ((unsigned char)*str);
+       *str = TOLOWER (*str);
       str++;
     }
 }
@@ -1470,8 +1470,8 @@ getlc (file)
   register int c;
 
   c = getc (file);  
-  if (ISUPPER (c) && ignore_case)
-    c = tolower (c);
+  if (ignore_case)
+    c = TOLOWER (c);
   return c;
 }
 \f
@@ -1524,7 +1524,7 @@ handle_generic_pragma (buffer)
          * buff ++ = c;
          c = getc (finput);
        }
-      while (c != EOF && isascii (c) && ! isspace (c) && c != '\n'
+      while (c != EOF && isascii (c) && ! ISSPACE (c) && c != '\n'
             && buff < buffer + 128); /* XXX shared knowledge about size of buffer.  */
       
       ungetc (c, finput);
@@ -1577,8 +1577,8 @@ check_newline ()
      it and ignore it; otherwise, ignore the line, with an error
      if the word isn't `pragma', `ident', `define', or `undef'.  */
 
-  if (ISUPPER (c) && ignore_case)
-    c = tolower (c);
+  if (ignore_case)
+    c = TOLOWER (c);
 
   if (c >= 'a' && c <= 'z')
     {
index 517ba0f189b79d346c1951da23bb5a042c01d214..dafcb19dc9cf7dcf715f8cc5b44e62cbf95f23d4 100644 (file)
@@ -682,8 +682,8 @@ c4x_interrupt_function_p ()
     && current_function_name[2] == 'i'
     && current_function_name[3] == 'n' 
     && current_function_name[4] == 't'
-    && isdigit (current_function_name[5])
-    && isdigit (current_function_name[6]);
+    && ISDIGIT (current_function_name[5])
+    && ISDIGIT (current_function_name[6]);
 }
 
 
@@ -4193,13 +4193,13 @@ c4x_handle_pragma (p_getc, p_ungetc, pname)
 
   c = p_getc ();
   while (c == ' ' || c == '\t') c = p_getc ();
-  if (! (isalpha(c) || c == '_' || c == '$' || c == '@'))
+  if (! (ISALPHA(c) || c == '_' || c == '$' || c == '@'))
     return 0;
 
   i = 0;
   namesize = 16;
   name = xmalloc (namesize);
-  while (isalnum (c) || c == '_' || c == '$' || c == '@')
+  while (ISALNUM (c) || c == '_' || c == '$' || c == '@')
     {
       if (i >= namesize-1)
        {
index c999b5819b81de17fa18b46eb2e9836d2edb7e28..e6830277fda3d9d9e3810e15845b571a01ea39ad 100644 (file)
@@ -976,7 +976,7 @@ handle_pragma (finput, node)
          do {
            *s++ = c;
            c = getc (finput);
-         } while (isalnum(c) || c == '_');
+         } while (ISALNUM(c) || c == '_');
          if (c == '\n')
            goto PRAGMA_WARNING;
          *s = 0;
@@ -1014,7 +1014,7 @@ handle_pragma (finput, node)
                      }
                    *s++ = c;
                    c = getc (finput);
-                   if (isspace(c) || c == ')')
+                   if (ISSPACE(c) || c == ')')
                      goto PRAGMA_WARNING;
                  } while (c != '"');
                  *s = 0;
index d87369b07fcb99d0674d9dec29721b02f12fdc2d..45da9fa7c49baea7f7bcee7e939bf91c6b174a15 100644 (file)
@@ -1138,7 +1138,7 @@ enum reg_class
     ch = '@';                                                          \
   for (bp = temp; *bp; bp++)                                           \
     {                                                                  \
-      if (islower (*bp)) *bp = toupper (*bp);                          \
+      *bp = TOUPPER (*bp);                                             \
       else if (*bp == '_') *bp = ch;                                   \
     }                                                                  \
   fprintf (FILE, "%s", temp);                                          \
@@ -1256,7 +1256,7 @@ enum reg_class
   for (j = 0, i = 0; i < LEN; j++, i++)                                        \
     {                                                                  \
       c = PTR[i];                                                      \
-      if (iscntrl (c) || c == '&')                                     \
+      if (ISCNTRL (c) || c == '&')                                     \
        {                                                               \
          if (j % MVS_ASCII_TEXT_LENGTH != 0 )                          \
            fprintf (FILE, "'\n");                                      \
index 0b68cede1eaae709193b8d1a9f5990b1ba5a55b8..6306cfc164537c0fb9925c4424ff1a8d80b8a04b 100644 (file)
@@ -134,7 +134,7 @@ override_options ()
     {
       if (small_memory[i].value)
        {
-         if (!isdigit (*small_memory[i].value))
+         if (!ISDIGIT (*small_memory[i].value))
            error ("%s=%s is not numeric.",
                   small_memory[i].name,
                   small_memory[i].value);
@@ -3022,8 +3022,7 @@ v850_handle_pragma (p_getc, p_ungetc, name)
          /* Read string.  */
          do
            * buff ++ = (c = p_getc ());
-         while (c != EOF && isascii (c)
-                && (isalnum (c) || c == '_' || c == '.' || c == ' ')
+         while (c != EOF && (ISALNUM (c) || c == '_' || c == '.' || c == ' ')
                 && (buff < buffer + 126));
          
          if (c != '"')
@@ -3033,8 +3032,7 @@ v850_handle_pragma (p_getc, p_ungetc, name)
          break;
 
        default:
-         while (c != EOF && isascii (c)
-                && (isalnum (c) || c == '_' || c == '.')
+         while (c != EOF && (ISALNUM (c) || c == '_' || c == '.')
                 && (buff < buffer + 126))
            * buff ++ = (c = p_getc ());
          break;
index 2dc4ddef9761afd6b24b805f70bac86436219ff5..9d01f9a008c4524eaf38e653116608f778cdc72c 100644 (file)
@@ -88,7 +88,7 @@ _doprnt (format, ap, stream)
          if (*ptr == '*')
            COPY_VA_INT;
          else
-           while (isdigit(*ptr)) /* Handle explicit numeric value. */
+           while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
              *sptr++ = *ptr++;
          
          if (*ptr == '.')
@@ -97,7 +97,7 @@ _doprnt (format, ap, stream)
              if (*ptr == '*')
                COPY_VA_INT;
              else
-               while (isdigit(*ptr)) /* Handle explicit numeric value. */
+               while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
                  *sptr++ = *ptr++;
            }
          while (strchr ("hlL", *ptr))
index acf6222baa0d7b493f1aec1cd57aa5740a5393f0..8fd19f3a4cf6e626f8e7fcbf0e1fb4c0f3dd5a9f 100644 (file)
@@ -1,3 +1,15 @@
+Thu Sep 16 18:07:11 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * bad.c (ffebad_finish): Use uppercase ctype macro from system.h.
+
+       * fini.c (main): Likewise.
+
+       * intrin.c (ffeintrin_init_0): Likewise.
+
+       * lex.c (ffelex_hash_): Likewise.
+
+       * src.c (ffesrc_init_1): Likewise.
+
 Tue Sep 14 12:14:28 1999  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * g77spec.c (lang_specific_driver): Remove unnecessary argument in
index 704fa1243eac57560e09ecc28c2f8b826f1a7b52..5b42129ebf6c94bbb5438355fc2936046ef010a3 100644 (file)
@@ -461,7 +461,7 @@ ffebad_finish ()
        {
          char c;
 
-         c = toupper (s[0]);
+         c = TOUPPER (s[0]);
          fprintf (stderr, "%c%s ", c, &s[1]);
        }
       else if (s[0] != '\0')
index 1b7c98194095ed71c96ccd48c7ea613841818d2f..d09161fdee6d62b2ca5bc1fd92b085bc7c6fb73e 100644 (file)
@@ -381,8 +381,8 @@ main (int argc, char **argv)
          cc = buf[i];
          if (ISALPHA (cc))
            {
-             newname->name_uc[i] = toupper (cc);
-             newname->name_lc[i] = tolower (cc);
+             newname->name_uc[i] = TOUPPER (cc);
+             newname->name_lc[i] = TOLOWER (cc);
              newname->name_ic[i] = cc;
            }
          else
index dbf375b849f9fa003b2c92f2f7a435972a07dd8d..d59458c60fee1b276908b30b5ad2b19d45fc9490 100644 (file)
@@ -1588,7 +1588,7 @@ ffeintrin_init_0 ()
          if ((ISDIGIT (*p1) || (*p1 == '_')) && (*p1 == *p2) && (*p1 == *p3))
            continue;
          if (! ISUPPER ((unsigned char)*p1) || ! ISLOWER ((unsigned char)*p2)
-             || (*p1 != toupper ((unsigned char)*p2))
+             || (*p1 != TOUPPER (*p2))
              || ((*p3 != *p1) && (*p3 != *p2)))
            break;
        }
index 3136d40252890f5ec959260588c8197505ef1e19..b6198b215f1fc17858544f0d78e15f5c69e4a9a0 100644 (file)
@@ -1126,8 +1126,9 @@ ffelex_hash_ (FILE *finput)
              static char buffer [128];
              char * buff = buffer;
 
-             /* Read the pragma name into a buffer.  */
-             while (isspace (c = getc (finput)))
+             /* Read the pragma name into a buffer.
+                ISSPACE() may evaluate its argument more than once!  */
+             while (((c = getc (finput)), ISSPACE(c)))
                continue;
              
              do
@@ -1135,7 +1136,7 @@ ffelex_hash_ (FILE *finput)
                  * buff ++ = c;
                  c = getc (finput);
                }
-             while (c != EOF && ! isspace (c) && c != '\n'
+             while (c != EOF && ! ISSPACE (c) && c != '\n'
                     && buff < buffer + 128);
 
              pragma_ungetc (c);
index 7b23931040806a64b7ecd6a0df6e0d278196cbb6..e434fbf95e8ea3258f2c97ab9e2eb1ff2a02d1fa 100644 (file)
@@ -120,10 +120,10 @@ ffesrc_init_1 ()
     }
 
   for (i = 'A'; i <= 'Z'; ++i)
-    ffesrc_tolower_[i] = tolower (i);
+    ffesrc_tolower_[i] = TOLOWER (i);
 
   for (i = 'a'; i <= 'z'; ++i)
-    ffesrc_toupper_[i] = toupper (i);
+    ffesrc_toupper_[i] = TOUPPER (i);
 
   ffesrc_check_symbol_ = (ffe_case_symbol () != FFE_caseNONE);
 
@@ -153,7 +153,7 @@ ffesrc_init_1 ()
 
   if (ffesrc_ok_match_init_lower_)
     for (i = 'a'; i <= 'z'; ++i)
-      ffesrc_char_match_init_[i] = toupper (i);
+      ffesrc_char_match_init_[i] = TOUPPER (i);
   else
     for (i = 'a'; i <= 'z'; ++i)
       ffesrc_char_match_init_[i] = FFESRC_INVALID_SYMBOL_CHAR_;
@@ -164,21 +164,21 @@ ffesrc_init_1 ()
 
   if (ffesrc_ok_match_noninit_lower_)
     for (i = 'a'; i <= 'z'; ++i)
-      ffesrc_char_match_noninit_[i] = toupper (i);
+      ffesrc_char_match_noninit_[i] = TOUPPER (i);
   else
     for (i = 'a'; i <= 'z'; ++i)
       ffesrc_char_match_noninit_[i] = FFESRC_INVALID_SYMBOL_CHAR_;
 
   if (ffe_case_source () == FFE_caseLOWER)
     for (i = 'A'; i <= 'Z'; ++i)
-      ffesrc_char_source_[i] = tolower (i);
+      ffesrc_char_source_[i] = TOLOWER (i);
   else if (ffe_case_source () == FFE_caseUPPER)
     for (i = 'a'; i <= 'z'; ++i)
-      ffesrc_char_source_[i] = toupper (i);
+      ffesrc_char_source_[i] = TOUPPER (i);
 
   if (ffe_case_match () == FFE_caseLOWER)
     for (i = 'A'; i <= 'Z'; ++i)
-      ffesrc_char_internal_init_[i] = tolower (i);
+      ffesrc_char_internal_init_[i] = TOLOWER (i);
 
   switch (ffe_case_symbol ())
     {
index 036c6fa9d034ef7fc535bdc100a24c86526e62d8..1a570f23bbaafdfa59cba079f3cf9e4379c6a459 100644 (file)
@@ -221,13 +221,13 @@ main (argc, argv)
           {
             if (fgets (pz_buf, MAXPATHLEN, stdin) == (char *) NULL)
               break;
-            while (isspace (*pz_buf))
+            while (ISSPACE (*pz_buf))
               pz_buf++;
             if ((*pz_buf == '\0') || (*pz_buf == '#'))
               continue;
             apz_names[file_name_ct++] = pz_buf;
             pz_buf += strlen (pz_buf);
-            while (isspace (pz_buf[-1]))
+            while (ISSPACE (pz_buf[-1]))
               pz_buf--;
             *pz_buf++ = '\0';
           }
@@ -813,7 +813,7 @@ quoted_file_exists (pz_src_path, pz_file_path, pz_file)
 
   for (;;) {
     char ch = *pz_file++;
-    if (! isgraph( ch ))
+    if (! ISGRAPH(ch))
       return 0;
     if (ch == '"')
       break;
@@ -875,9 +875,10 @@ extract_quoted_files (pz_data, pz_file_name, p_re_match)
       pz_incl_quot += p_re_match->rm_so;
 
       /*  Skip forward to the included file name */
-      while (isspace (*pz_incl_quot))
+      while (ISSPACE (*pz_incl_quot))
         pz_incl_quot++;
-      while (isspace (*++pz_incl_quot))
+      /* ISSPACE() may evaluate is argument more than once!  */
+      while ((++pz_incl_quot, ISSPACE (*pz_incl_quot)))
         ;
       pz_incl_quot += sizeof ("include") - 1;
       while (*pz_incl_quot++ != '"')
index 9f9bd6b34713c894a4b0f241c24e1a8afe6ce690..06fa26ac6a6103d8360a738740b53ac2297873a3 100644 (file)
@@ -163,7 +163,7 @@ load_data (fp)
       return (char *) NULL;
     }
 
-  while ((pz_scan > pz_text) && isspace (pz_scan[-1]))
+  while ((pz_scan > pz_text) && ISSPACE (pz_scan[-1]))
     pz_scan--;
   *pz_scan = NUL;
   return realloc ((void *) pz_text, strlen (pz_text) + 1);
index d3a7696413d37d7ac86ca99287cef756c9717766..cddcded25ee7869c3a1905cc5b41060caf230cda 100644 (file)
@@ -1072,7 +1072,7 @@ real_hex_to_f (s, mode)
             }
           /* Value of exponent.
              The exponent field is a decimal integer.  */
-          while (isdigit(*p))
+          while (ISDIGIT(*p))
             {
               k = (*p++ & 0x7f) - '0';
               expon = 10 * expon + k;
index 9a3357adb9a3174f9af7c5f82bad8e8f3964f4ba..4316c3540ba51456b13476a1f907dea4b0c2bad1 100644 (file)
@@ -56,7 +56,7 @@ struct function_unit
 
 static void extend_range PROTO((struct range *, int, int));
 static void init_range PROTO((struct range *));
-static void write_upcase PROTO((char *));
+static void write_upcase PROTO((const char *));
 static void gen_attr PROTO((rtx));
 static void write_units PROTO((int, struct range *, struct range *,
                               struct range *, struct range *,
@@ -81,13 +81,10 @@ init_range (range)
 
 static void
 write_upcase (str)
-    char *str;
+    const char *str;
 {
   for (; *str; str++)
-    if (ISLOWER(*str))
-      printf ("%c", toupper(*str));
-    else
-      printf ("%c", *str);
+    putchar (TOUPPER(*str));
 }
 
 static void
@@ -117,10 +114,8 @@ gen_attr (attr)
              write_upcase (XSTR (attr, 0));
              printf ("_");
            }
-         else if (ISLOWER(*p))
-           printf ("%c", toupper(*p));
          else
-           printf ("%c", *p);
+           putchar (TOUPPER(*p));
        }
 
       printf ("};\n");
index f0ba4de79b229e8c21a5d45d2270385677647b83..f35e0e4a5f1aca709b5b6bc778e70c773960aba5 100644 (file)
@@ -434,7 +434,7 @@ static void write_attr_case PROTO((struct attr_desc *, struct attr_value *,
 static void write_unit_name    PROTO((const char *, int, const char *));
 static void write_attr_valueq  PROTO((struct attr_desc *, char *));
 static void write_attr_value   PROTO((struct attr_desc *, rtx));
-static void write_upcase       PROTO((char *));
+static void write_upcase       PROTO((const char *));
 static void write_indent       PROTO((int));
 static void write_eligible_delay PROTO((const char *));
 static void write_function_unit_info PROTO((void));
@@ -1354,8 +1354,7 @@ convert_const_symbol_ref (exp, attr)
       strcat (p, "_");
       strcat (p, XSTR (av->value, 0));
       for (; *p != '\0'; p++)
-       if (ISLOWER(*p))
-         *p = toupper (*p);
+       *p = TOUPPER (*p);
 
       value = attr_rtx (SYMBOL_REF, string);
       RTX_UNCHANGING_P (value) = 1;
@@ -2838,8 +2837,7 @@ evaluate_eq_attr (exp, value, insn_code, insn_index)
       strcat (string, "_");
       strcat (string, XSTR (exp, 1));
       for (p = string; *p ; p++)
-       if (ISLOWER(*p))
-         *p = toupper (*p);
+       *p = TOUPPER (*p);
       
       newexp = attr_rtx (EQ, value,
                         attr_rtx (SYMBOL_REF,
@@ -5351,13 +5349,14 @@ write_attr_value (attr, value)
 
 static void
 write_upcase (str)
-     char *str;
+     const char *str;
 {
   while (*str)
-    if (ISLOWER(*str))
-      printf ("%c", toupper(*str++));
-    else
-      printf ("%c", *str++);
+  {
+    /* The argument of TOUPPER should not have side effects.  */
+    putchar (TOUPPER(*str));
+    str++;
+  }
 }
 
 static void
index 6b3687d11105455b67d92f2bfba0edb2a4400e41..d1b3a1b43274f7e5b4ddeea315c19ddcba9bd45c 100644 (file)
@@ -135,12 +135,7 @@ print_code (code)
 {
   register const char *p1;
   for (p1 = GET_RTX_NAME (code); *p1; p1++)
-    {
-      if (ISLOWER(*p1))
-       putchar (toupper(*p1));
-      else
-       putchar (*p1);
-    }
+    putchar (TOUPPER(*p1));
 }
 
 static void
index f364a012e06fc3396bb5f7fa7ef5a1eac447b53b..58846916f8cf1845b453de63d243203d8f21e542 100644 (file)
@@ -195,7 +195,7 @@ gen_insn (insn)
                for (i = ((int) MAX_MACHINE_MODE) - 1; i >= 0; i--)
                  {
                    for (p = GET_MODE_NAME(i), q = np; *p; p++, q++)
-                     if (tolower ((unsigned char)*p) != *q)
+                     if (TOLOWER (*p) != *q)
                        break;
 
                    if (*p == 0
@@ -249,11 +249,11 @@ gen_insn (insn)
            break;
          case 'a':
            for (np = GET_MODE_NAME(m1); *np; np++)
-             printf ("%c", tolower ((unsigned char)*np));
+             putchar (TOLOWER (*np));
            break;
          case 'b':
            for (np = GET_MODE_NAME(m2); *np; np++)
-             printf ("%c", tolower ((unsigned char)*np));
+             putchar (TOLOWER (*np));
            break;
          case 'A':
            printf ("%smode", GET_MODE_NAME(m1));
@@ -266,7 +266,7 @@ gen_insn (insn)
            break;
          case 'C':
            for (np = GET_RTX_NAME(op); *np; np++)
-             printf ("%c", toupper ((unsigned char)*np));
+             putchar (TOUPPER (*np));
            break;
          }
     }
index 8c02ba3bc3b9f2661332891ea367fdac47eebcef..e5f4833c3bb1cd7e409064aa7be3359972c61f17 100644 (file)
@@ -370,12 +370,7 @@ print_code (code)
 {
   register const char *p1;
   for (p1 = GET_RTX_NAME (code); *p1; p1++)
-    {
-      if (ISLOWER(*p1))
-       putchar (toupper(*p1));
-      else
-       putchar (*p1);
-    }
+    putchar (TOUPPER(*p1));
 }
 \f
 PTR
index 0d6a2d10a704d25d93c20bac2372976e37080458..49d4a4ea8a24df218836839e680e8ee72ee2e688 100644 (file)
@@ -1639,12 +1639,7 @@ print_code (code)
 {
   register const char *p1;
   for (p1 = GET_RTX_NAME (code); *p1; p1++)
-    {
-      if (ISLOWER(*p1))
-       putchar (toupper(*p1));
-      else
-       putchar (*p1);
-    }
+    putchar (TOUPPER(*p1));
 }
 
 static int
index 558be7d12b5fce14f3aaa52b4d26906d47dad689..455a37d65a5ecfd5e6da1d3de04064ade42420a3 100644 (file)
@@ -4324,7 +4324,7 @@ init_libfuncs (optable, first_mode, last_mode, opname, suffix)
       for (q = opname; *q; )
        *p++ = *q++;
       for (q = mname; *q; q++)
-       *p++ = tolower ((unsigned char)*q);
+       *p++ = TOLOWER (*q);
       *p++ = suffix;
       *p++ = '\0';
 
index 960e174f0560ed48d915c1c020bf7856ab587018..9252098e8ecfd2160947d01ae26c2fbffe7a2a41 100644 (file)
@@ -89,27 +89,52 @@ extern int fputs_unlocked PROTO ((const char *, FILE *));
 # define IN_CTYPE_DOMAIN(c) isascii(c)
 #endif
 
+/* The ctype functions are often implemented as macros which do
+   lookups in arrays using the parameter as the offset.  If the ctype
+   function parameter is a char, then gcc will (appropriately) warn
+   that a "subscript has type char".  Using a (signed) char as a subscript
+   is bad because you may get negative offsets and thus it is not 8-bit
+   safe.  The CTYPE_CONV macro ensures that the parameter is cast to an
+   unsigned char when a char is passed in.  When an int is passed in, the
+   parameter is left alone so we don't lose EOF.
+*/
+
+#define CTYPE_CONV(CH) \
+  (sizeof(CH) == sizeof(unsigned char) ? (int)(unsigned char)(CH) : (int)(CH))
+
+
+/* WARNING!  The argument to the ctype replacement macros below is
+   evaluated more than once so it must not have side effects!  */
+
 #ifdef isblank
-# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (c))
+# define ISBLANK(c) (IN_CTYPE_DOMAIN (c) && isblank (CTYPE_CONV(c)))
 #else
 # define ISBLANK(c) ((c) == ' ' || (c) == '\t')
 #endif
 #ifdef isgraph
-# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (c))
+# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isgraph (CTYPE_CONV(c)))
+#else
+# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (CTYPE_CONV(c)) && !isspace (CTYPE_CONV(c)))
+#endif
+
+#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (CTYPE_CONV(c)))
+#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (CTYPE_CONV(c)))
+#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (CTYPE_CONV(c)))
+#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (CTYPE_CONV(c)))
+#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (CTYPE_CONV(c)))
+#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (CTYPE_CONV(c)))
+#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (CTYPE_CONV(c)))
+#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (CTYPE_CONV(c)))
+#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (CTYPE_CONV(c)))
+#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (CTYPE_CONV(c)))
+
+#if STDC_HEADERS
+# define TOLOWER(c) (tolower (CTYPE_CONV(c)))
+# define TOUPPER(c) (toupper (CTYPE_CONV(c)))
 #else
-# define ISGRAPH(c) (IN_CTYPE_DOMAIN (c) && isprint (c) && !isspace (c))
-#endif
-
-#define ISPRINT(c) (IN_CTYPE_DOMAIN (c) && isprint (c))
-#define ISALNUM(c) (IN_CTYPE_DOMAIN (c) && isalnum (c))
-#define ISALPHA(c) (IN_CTYPE_DOMAIN (c) && isalpha (c))
-#define ISCNTRL(c) (IN_CTYPE_DOMAIN (c) && iscntrl (c))
-#define ISLOWER(c) (IN_CTYPE_DOMAIN (c) && islower (c))
-#define ISPUNCT(c) (IN_CTYPE_DOMAIN (c) && ispunct (c))
-#define ISSPACE(c) (IN_CTYPE_DOMAIN (c) && isspace (c))
-#define ISUPPER(c) (IN_CTYPE_DOMAIN (c) && isupper (c))
-#define ISXDIGIT(c) (IN_CTYPE_DOMAIN (c) && isxdigit (c))
-#define ISDIGIT_LOCALE(c) (IN_CTYPE_DOMAIN (c) && isdigit (c))
+# define TOLOWER(c) (ISUPPER (c) ? tolower (CTYPE_CONV(c)) : (c))
+# define TOUPPER(c) (ISLOWER (c) ? toupper (CTYPE_CONV(c)) : (c))
+#endif
 
 /* ISDIGIT differs from ISDIGIT_LOCALE, as follows:
    - Its arg may be any int or unsigned int; it need not be an unsigned char.