+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
* 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++)
* 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++)
* 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++)
+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.
while (*str)
{
if (ISUPPER ((unsigned char) *str))
- *str = tolower ((unsigned char)*str);
+ *str = TOLOWER (*str);
str++;
}
}
register int c;
c = getc (file);
- if (ISUPPER (c) && ignore_case)
- c = tolower (c);
+ if (ignore_case)
+ c = TOLOWER (c);
return c;
}
\f
* 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);
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')
{
&& 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]);
}
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)
{
do {
*s++ = c;
c = getc (finput);
- } while (isalnum(c) || c == '_');
+ } while (ISALNUM(c) || c == '_');
if (c == '\n')
goto PRAGMA_WARNING;
*s = 0;
}
*s++ = c;
c = getc (finput);
- if (isspace(c) || c == ')')
+ if (ISSPACE(c) || c == ')')
goto PRAGMA_WARNING;
} while (c != '"');
*s = 0;
ch = '@'; \
for (bp = temp; *bp; bp++) \
{ \
- if (islower (*bp)) *bp = toupper (*bp); \
+ *bp = TOUPPER (*bp); \
else if (*bp == '_') *bp = ch; \
} \
fprintf (FILE, "%s", temp); \
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"); \
{
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);
/* 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 != '"')
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;
if (*ptr == '*')
COPY_VA_INT;
else
- while (isdigit(*ptr)) /* Handle explicit numeric value. */
+ while (ISDIGIT(*ptr)) /* Handle explicit numeric value. */
*sptr++ = *ptr++;
if (*ptr == '.')
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))
+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
{
char c;
- c = toupper (s[0]);
+ c = TOUPPER (s[0]);
fprintf (stderr, "%c%s ", c, &s[1]);
}
else if (s[0] != '\0')
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
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;
}
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
* 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);
}
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);
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_;
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 ())
{
{
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';
}
for (;;) {
char ch = *pz_file++;
- if (! isgraph( ch ))
+ if (! ISGRAPH(ch))
return 0;
if (ch == '"')
break;
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++ != '"')
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);
}
/* Value of exponent.
The exponent field is a decimal integer. */
- while (isdigit(*p))
+ while (ISDIGIT(*p))
{
k = (*p++ & 0x7f) - '0';
expon = 10 * expon + k;
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 *,
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
write_upcase (XSTR (attr, 0));
printf ("_");
}
- else if (ISLOWER(*p))
- printf ("%c", toupper(*p));
else
- printf ("%c", *p);
+ putchar (TOUPPER(*p));
}
printf ("};\n");
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));
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;
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,
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
{
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
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
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));
break;
case 'C':
for (np = GET_RTX_NAME(op); *np; np++)
- printf ("%c", toupper ((unsigned char)*np));
+ putchar (TOUPPER (*np));
break;
}
}
{
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
{
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
for (q = opname; *q; )
*p++ = *q++;
for (q = mname; *q; q++)
- *p++ = tolower ((unsigned char)*q);
+ *p++ = TOLOWER (*q);
*p++ = suffix;
*p++ = '\0';
# 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.