* Patch for isdigit/isalpha/etc. macro arguments
@ 2007-04-06 22:34 Steve Ellcey
2007-04-06 23:06 ` Mark Kettenis
0 siblings, 1 reply; 22+ messages in thread
From: Steve Ellcey @ 2007-04-06 22:34 UTC (permalink / raw)
To: gdb-patches
While getting gdb to build on hppa hp-ux I ran into an interesting
problem. I was building with gcc which means that the gdb makefile will
use -Wall and -Werror as options (a good thing in my opinion). The
problem I ran into is with the use of the isdigit, isalpha, isupper,
etc. macros.
With GCC 4.1.1 and the -Wall -Werror options, if you access an array
with a char expression as the index instead of an int expression you get
an error.
proj/opensrc/nightly/src/src/gdb/exec.c: In function 'set_section_command':
/proj/opensrc/nightly/src/src/gdb/exec.c:648: warning: array subscript has type 'char'
make[1]: *** [exec.o] Error 1
make[1]: Leaving directory `/proj/opensrc/nightly/build-hppa1.1-hp-hpux11.11-trunk/obj_src/gdb'
make: *** [all-gdb] Error 2
This doesn't happen when using the isdigit, etc. macros on
Linux because isdigit(c) expands to something like "__array[(int) c] &
MASK", i.e. the macro contains an explicit integer cast and so GCC
doesn't complain about a non-integer array index.
HP-UX does not put the int cast in the array reference in the macros, so
if the argument to isdigit is not an int, you get an error (when using
gcc -Wall -Werror).
Here is a patch to cast the arguments to isalpha, etc. With this patch
and my previous HP-UX specific patch I was able to build gdb on hppa
hp-ux.
Is this patch OK to checkin?
2007-04-06 Steve Ellcey <sje@cup.hp.com>
* ada-exp.y: Cast idigit, islower, isupper, isalpha, etc. arg to int.
* ada-lang.c: Ditto.
* ada-lex.l: Ditto.
* ada-typeprint.c: Ditto.
* breakpoint.c: Ditto.
* coffread.c: Ditto.
* completer.c: Ditto.
* cp-support.c: Ditto.
* exec.c: Ditto.
* expprint.c: Ditto.
* gnu-v2-abi.c: Ditto.
* infcmd.c: Ditto.
* infrun.c: Ditto.
* jv-exp.y: Ditto.
* main.c: Ditto.
* maint.c: Ditto.
* minsyms.c: Ditto.
* objc-exp.y: Ditto.
* objc-lang.c: Ditto.
* p-exp.y: Ditto.
* p-typeprint.c: Ditto.
* parse.c: Ditto.
* remote-utils.c: Ditto.
* remote.c: Ditto.
* serial.c: Ditto.
* stabsread.c: Ditto.
* stack.c: Ditto.
* symfile.c: Ditto.
* symtab.c: Ditto.
* thread.c: Ditto.
* utils.c: Ditto.
* cli/cli-cmds.c: Ditto.
* cli/cli-decode.c: Ditto.
* cli/cli-dump.c: Ditto.
* cli/cli-script.c: Ditto.
* cli/cli-setshow.c: Ditto.
* mi/mi-cmd-var.c: Ditto.
* mi/mi-parse.c: Ditto.
* tui/tui-win.c: Ditto.
Index: ada-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/ada-exp.y,v
retrieving revision 1.20
diff -p -u -r1.20 ada-exp.y
--- ada-exp.y 9 Jan 2007 17:58:49 -0000 1.20
+++ ada-exp.y 6 Apr 2007 22:06:44 -0000
@@ -908,7 +908,7 @@ write_object_renaming (struct block *ori
slice_state = LOWER_BOUND;
case 'S':
suffix += 1;
- if (isdigit (*suffix))
+ if (isdigit ((int) *suffix))
{
char *next;
long val = strtol (suffix, &next, 10);
Index: ada-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-lang.c,v
retrieving revision 1.95
diff -p -u -r1.95 ada-lang.c
--- ada-lang.c 29 Mar 2007 21:57:01 -0000 1.95
+++ ada-lang.c 6 Apr 2007 22:06:45 -0000
@@ -738,7 +738,7 @@ is_suppressed_name (const char *str)
if (suffix == NULL)
suffix = str + strlen (str);
for (p = suffix - 1; p != str; p -= 1)
- if (isupper (*p))
+ if (isupper ((int) *p))
{
int i;
if (p[0] == 'X' && p[-1] != '_')
@@ -840,7 +840,7 @@ ada_fold_name (const char *name)
static int
is_lower_alphanum (const char c)
{
- return (isdigit (c) || (isalpha (c) && islower (c)));
+ return (isdigit ((int) c) || (isalpha ((int) c) && islower ((int) c)));
}
/* Decode:
@@ -883,10 +883,10 @@ ada_decode (const char *encoded)
/* Remove trailing .{DIGIT}+ or ___{DIGIT}+ or __{DIGIT}+. */
len0 = strlen (encoded);
- if (len0 > 1 && isdigit (encoded[len0 - 1]))
+ if (len0 > 1 && isdigit ((int) encoded[len0 - 1]))
{
i = len0 - 2;
- while (i > 0 && isdigit (encoded[i]))
+ while (i > 0 && isdigit ((int) encoded[i]))
i--;
if (i >= 0 && encoded[i] == '.')
len0 = i;
@@ -910,7 +910,8 @@ ada_decode (const char *encoded)
if (len0 > 1
&& encoded[len0 - 1] == 'N'
- && (isdigit (encoded[len0 - 2]) || islower (encoded[len0 - 2])))
+ && (isdigit ((int) encoded[len0 - 2])
+ || islower ((int) encoded[len0 - 2])))
len0--;
/* Remove the ___X.* suffix if present. Do not forget to verify that
@@ -936,11 +937,11 @@ ada_decode (const char *encoded)
GROW_VECT (decoding_buffer, decoding_buffer_size, 2 * len0 + 1);
decoded = decoding_buffer;
- if (len0 > 1 && isdigit (encoded[len0 - 1]))
+ if (len0 > 1 && isdigit ((int) encoded[len0 - 1]))
{
i = len0 - 2;
- while ((i >= 0 && isdigit (encoded[i]))
- || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1])))
+ while ((i >= 0 && isdigit ((int) encoded[i]))
+ || (i >= 1 && encoded[i] == '_' && isdigit ((int) encoded[i - 1])))
i -= 1;
if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_')
len0 = i - 1;
@@ -948,7 +949,7 @@ ada_decode (const char *encoded)
len0 = i;
}
- for (i = 0, j = 0; i < len0 && !isalpha (encoded[i]); i += 1, j += 1)
+ for (i = 0, j = 0; i < len0 && !isalpha ((int) encoded[i]); i += 1, j += 1)
decoded[j] = encoded[i];
at_start_name = 1;
@@ -962,7 +963,7 @@ ada_decode (const char *encoded)
int op_len = strlen (ada_opname_table[k].encoded);
if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1,
op_len - 1) == 0)
- && !isalnum (encoded[i + op_len]))
+ && !isalnum ((int) encoded[i + op_len]))
{
strcpy (decoded + j, ada_opname_table[k].decoded);
at_start_name = 0;
@@ -996,11 +997,11 @@ ada_decode (const char *encoded)
internally generated. */
if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E'
- && isdigit (encoded[i+2]))
+ && isdigit ((int) encoded[i+2]))
{
int k = i + 3;
- while (k < len0 && isdigit (encoded[k]))
+ while (k < len0 && isdigit ((int) encoded[k]))
k++;
if (k < len0
@@ -1034,7 +1035,7 @@ ada_decode (const char *encoded)
i++;
}
- if (encoded[i] == 'X' && i != 0 && isalnum (encoded[i - 1]))
+ if (encoded[i] == 'X' && i != 0 && isalnum ((int) encoded[i - 1]))
{
do
i += 1;
@@ -1060,7 +1061,7 @@ ada_decode (const char *encoded)
decoded[j] = '\000';
for (i = 0; decoded[i] != '\0'; i += 1)
- if (isupper (decoded[i]) || decoded[i] == ' ')
+ if (isupper ((int) decoded[i]) || decoded[i] == ' ')
goto Suppress;
if (strcmp (decoded, encoded) == 0)
@@ -3134,9 +3135,9 @@ encoded_ordered_before (char *N0, char *
else
{
int k0, k1;
- for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1)
+ for (k0 = strlen (N0) - 1; k0 > 0 && isdigit ((int) N0[k0]); k0 -= 1)
;
- for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1)
+ for (k1 = strlen (N1) - 1; k1 > 0 && isdigit ((int) N1[k1]); k1 -= 1)
;
if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0 + 1] != '\000'
&& (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000')
@@ -3318,7 +3319,7 @@ get_selections (int *choices, int n_choi
char *args2;
int choice, j;
- while (isspace (*args))
+ while (isspace ((int) *args))
args += 1;
if (*args == '\0' && n_chosen == 0)
error_no_arg (_("one or more choice numbers"));
@@ -4715,10 +4716,10 @@ is_name_suffix (const char *str)
/* (__[0-9]+)?\.[0-9]+ */
matching = str;
- if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit (str[2]))
+ if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit ((int) str[2]))
{
matching += 3;
- while (isdigit (matching[0]))
+ while (isdigit ((int) matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -4727,7 +4728,7 @@ is_name_suffix (const char *str)
if (matching[0] == '.' || matching[0] == '$')
{
matching += 1;
- while (isdigit (matching[0]))
+ while (isdigit ((int) matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -4737,7 +4738,7 @@ is_name_suffix (const char *str)
if (len > 3 && str[0] == '_' && str[1] == '_' && str[2] == '_')
{
matching = str + 3;
- while (isdigit (matching[0]))
+ while (isdigit ((int) matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -4761,10 +4762,10 @@ is_name_suffix (const char *str)
#endif
/* _E[0-9]+[bs]$ */
- if (len > 3 && str[0] == '_' && str [1] == 'E' && isdigit (str[2]))
+ if (len > 3 && str[0] == '_' && str [1] == 'E' && isdigit ((int) str[2]))
{
matching = str + 3;
- while (isdigit (matching[0]))
+ while (isdigit ((int) matching[0]))
matching += 1;
if ((matching[0] == 'b' || matching[0] == 's')
&& matching [1] == '\0')
@@ -4812,17 +4813,17 @@ is_name_suffix (const char *str)
return 1;
return 0;
}
- if (!isdigit (str[2]))
+ if (!isdigit ((int) str[2]))
return 0;
for (k = 3; str[k] != '\0'; k += 1)
- if (!isdigit (str[k]) && str[k] != '_')
+ if (!isdigit ((int) str[k]) && str[k] != '_')
return 0;
return 1;
}
- if (str[0] == '$' && isdigit (str[1]))
+ if (str[0] == '$' && isdigit ((int) str[1]))
{
for (k = 2; str[k] != '\0'; k += 1)
- if (!isdigit (str[k]) && str[k] != '_')
+ if (!isdigit ((int) str[k]) && str[k] != '_')
return 0;
return 1;
}
@@ -4847,7 +4848,7 @@ is_dot_digits_suffix (const char *str)
return 0;
str++;
- while (isdigit (str[0]))
+ while (isdigit ((int) str[0]))
str++;
return (str[0] == '\0');
}
@@ -4864,7 +4865,7 @@ is_valid_name_for_wild_match (const char
int i;
for (i=0; decoded_name[i] != '\0'; i++)
- if (isalpha (decoded_name[i]) && !islower (decoded_name[i]))
+ if (isalpha ((int) decoded_name[i]) && !islower ((int) decoded_name[i]))
return 0;
return 1;
@@ -4947,14 +4948,14 @@ wild_match (const char *patn0, int patn_
return 0;
if (name[0] == '_')
{
- if (!islower (name[2]))
+ if (!islower ((int) name[2]))
return 0;
name += 2;
name_len -= 2;
}
else
{
- if (!islower (name[1]))
+ if (!islower ((int) name[1]))
return 0;
name += 1;
name_len -= 1;
@@ -5240,7 +5241,7 @@ ada_tag_name_1 (void *args0)
return 0;
read_memory_string (value_as_address (val), name, sizeof (name) - 1);
for (p = name; *p != '\0'; p += 1)
- if (isalpha (*p))
+ if (isalpha ((int) *p))
*p = tolower (*p);
args->name = name;
return 0;
@@ -5275,7 +5276,7 @@ ada_tag_name_2 (struct tag_args *args)
return 0;
read_memory_string (value_as_address (val), name, sizeof (name) - 1);
for (p = name; *p != '\0'; p += 1)
- if (isalpha (*p))
+ if (isalpha ((int) *p))
*p = tolower (*p);
args->name = name;
return 0;
@@ -5449,14 +5450,14 @@ ada_scan_number (const char str[], int k
{
ULONGEST RU;
- if (!isdigit (str[k]))
+ if (!isdigit ((int) str[k]))
return 0;
/* Do it the hard way so as not to make any assumption about
the relationship of unsigned long (%lu scan format code) and
LONGEST. */
RU = 0;
- while (isdigit (str[k]))
+ while (isdigit ((int) str[k]))
{
RU = RU * 10 + (str[k] - '0');
k += 1;
@@ -6116,10 +6117,10 @@ field_alignment (struct type *type, int
int len = (name == NULL) ? 0 : strlen (name);
int align_offset;
- if (!isdigit (name[len - 1]))
+ if (!isdigit ((int) name[len - 1]))
return 1;
- if (isdigit (name[len - 2]))
+ if (isdigit ((int) name[len - 2]))
align_offset = len - 2;
else
align_offset = len - 1;
@@ -7228,7 +7229,7 @@ ada_enum_name (const char *name)
{
while ((tmp = strstr (name, "__")) != NULL)
{
- if (isdigit (tmp[2]))
+ if (isdigit ((int) tmp[2]))
break;
else
name = tmp + 2;
@@ -9532,7 +9533,7 @@ ada_get_next_arg (char **argsp)
/* Skip any leading white space. */
- while (isspace (*args))
+ while (isspace ((int) *args))
args++;
if (args[0] == '\0')
@@ -9541,7 +9542,7 @@ ada_get_next_arg (char **argsp)
/* Find the end of the current argument. */
end = args;
- while (*end != '\0' && !isspace (*end))
+ while (*end != '\0' && !isspace ((int) *end))
end++;
/* Adjust ARGSP to point to the start of the next argument. */
@@ -9576,7 +9577,7 @@ catch_ada_exception_command_split (char
/* Check that we do not have any more arguments. Anything else
is unexpected. */
- while (isspace (*args))
+ while (isspace ((int) *args))
args++;
if (args[0] != '\0')
@@ -9797,7 +9798,7 @@ ada_decode_assert_location (char *args,
if (args != NULL)
{
- while (isspace (*args))
+ while (isspace ((int) *args))
args++;
if (*args != '\0')
error (_("Junk at end of arguments."));
Index: ada-lex.l
===================================================================
RCS file: /cvs/src/src/gdb/ada-lex.l,v
retrieving revision 1.17
diff -p -u -r1.17 ada-lex.l
--- ada-lex.l 9 Jan 2007 17:58:49 -0000 1.17
+++ ada-lex.l 6 Apr 2007 22:06:45 -0000
@@ -330,7 +330,7 @@ processInt (const char *base0, const cha
result = strtoulst (num0, (const char **) &trailer, base);
if (errno == ERANGE)
error (_("Integer literal out of range"));
- if (isxdigit(*trailer))
+ if (isxdigit((int) *trailer))
error (_("Invalid digit `%c' in based literal"), *trailer);
while (exp > 0)
@@ -406,12 +406,12 @@ processId (const char *name0, int len)
int i0, i;
struct stoken result;
- while (len > 0 && isspace (name0[len-1]))
+ while (len > 0 && isspace ((int) name0[len-1]))
len -= 1;
i = i0 = 0;
while (i0 < len)
{
- if (isalnum (name0[i0]))
+ if (isalnum ((int) name0[i0]))
{
name[i] = tolower (name0[i0]);
i += 1; i0 += 1;
@@ -510,9 +510,9 @@ find_dot_all (const char *str)
int i0 = i;
do
i += 1;
- while (isspace (str[i]));
+ while (isspace ((int) str[i]));
if (strncmp (str+i, "all", 3) == 0
- && ! isalnum (str[i+3]) && str[i+3] != '_')
+ && ! isalnum ((int) str[i+3]) && str[i+3] != '_')
return i0;
}
}
Index: ada-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/ada-typeprint.c,v
retrieving revision 1.15
diff -p -u -r1.15 ada-typeprint.c
--- ada-typeprint.c 9 Jan 2007 17:58:49 -0000 1.15
+++ ada-typeprint.c 6 Apr 2007 22:06:45 -0000
@@ -95,7 +95,7 @@ decoded_type_name (struct type *type)
if (s == name_buffer)
return name_buffer;
- if (!islower (s[1]))
+ if (!islower ((int) s[1]))
return NULL;
for (s = q = name_buffer; *s != '\0'; q += 1)
Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.243
diff -p -u -r1.243 breakpoint.c
--- breakpoint.c 27 Mar 2007 23:01:00 -0000 1.243
+++ breakpoint.c 6 Apr 2007 22:06:45 -0000
@@ -425,7 +425,7 @@ get_number_trailer (char **pp, int trail
char *start = ++p;
struct value *val;
- while (isalnum (*p) || *p == '_')
+ while (isalnum ((int) *p) || *p == '_')
p++;
varname = (char *) alloca (p - start + 1);
strncpy (varname, start, p - start);
@@ -457,14 +457,14 @@ get_number_trailer (char **pp, int trail
else
retval = atoi (*pp);
}
- if (!(isspace (*p) || *p == '\0' || *p == trailer))
+ if (!(isspace ((int) *p) || *p == '\0' || *p == trailer))
{
/* Trailing junk: return 0 and let caller print error msg. */
- while (!(isspace (*p) || *p == '\0' || *p == trailer))
+ while (!(isspace ((int) *p) || *p == '\0' || *p == trailer))
++p;
retval = 0;
}
- while (isspace (*p))
+ while (isspace ((int) *p))
p++;
*pp = p;
return retval;
@@ -5145,7 +5145,7 @@ parse_breakpoint_sals (char **address,
/* If no arg given, or if first arg is 'if ', use the default
breakpoint. */
if ((*address) == NULL
- || (strncmp ((*address), "if", 2) == 0 && isspace ((*address)[2])))
+ || (strncmp ((*address), "if", 2) == 0 && isspace ((int) (*address)[2])))
{
if (default_breakpoint_valid)
{
@@ -5710,7 +5710,7 @@ stopin_command (char *arg, int from_tty)
if (hasColon)
badInput = (*argptr != ':'); /* Not a class::method */
else
- badInput = isdigit (*arg); /* a simple line number */
+ badInput = isdigit ((int) *arg); /* a simple line number */
}
if (badInput)
@@ -5742,7 +5742,7 @@ stopat_command (char *arg, int from_tty)
if (hasColon)
badInput = (*argptr == ':'); /* we have class::method */
else
- badInput = !isdigit (*arg); /* not a line number */
+ badInput = !isdigit ((int) *arg); /* not a line number */
}
if (badInput)
@@ -6145,7 +6145,7 @@ ep_skip_leading_whitespace (char **s)
{
if ((s == NULL) || (*s == NULL))
return;
- while (isspace (**s))
+ while (isspace ((int) **s))
*s += 1;
}
@@ -6169,7 +6169,7 @@ ep_find_event_name_end (char *arg)
anything else delimites the token. */
while (*s != '\0')
{
- if (!isalnum (*s) && (*s != '_'))
+ if (!isalnum ((int) *s) && (*s != '_'))
break;
event_name_end = s;
s++;
@@ -6192,7 +6192,7 @@ ep_parse_optional_if_clause (char **arg)
{
char *cond_string;
- if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((*arg)[2]))
+ if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((int) (*arg)[2]))
return NULL;
/* Skip the "if" keyword. */
@@ -6227,13 +6227,13 @@ ep_parse_optional_filename (char **arg)
int i;
char c;
- if ((*arg_p == '\0') || isspace (*arg_p))
+ if ((*arg_p == '\0') || isspace ((int) *arg_p))
return NULL;
for (i = 0;; i++)
{
c = *arg_p;
- if (isspace (c))
+ if (isspace ((int) c))
c = '\0';
filename[i] = c;
if (c == '\0')
@@ -6269,7 +6269,7 @@ catch_fork_command_1 (catch_fork_kind fo
First, check if there's an if clause. */
cond_string = ep_parse_optional_if_clause (&arg);
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !isspace ((int) *arg))
error (_("Junk at end of arguments."));
/* If this target supports it, create a fork or vfork catchpoint
@@ -6302,7 +6302,7 @@ catch_exec_command_1 (char *arg, int tem
First, check if there's an if clause. */
cond_string = ep_parse_optional_if_clause (&arg);
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !isspace ((int) *arg))
error (_("Junk at end of arguments."));
/* If this target supports it, create an exec catchpoint
@@ -6342,7 +6342,7 @@ catch_load_command_1 (char *arg, int tem
cond_string = ep_parse_optional_if_clause (&arg);
}
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !isspace ((int) *arg))
error (_("Junk at end of arguments."));
/* Create a load breakpoint that only triggers when a load of
@@ -6384,7 +6384,7 @@ catch_unload_command_1 (char *arg, int t
cond_string = ep_parse_optional_if_clause (&arg);
}
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !isspace ((int) *arg))
error (_("Junk at end of arguments."));
/* Create an unload breakpoint that only triggers when an unload of
@@ -6533,7 +6533,7 @@ catch_exception_command_1 (enum exceptio
cond_string = ep_parse_optional_if_clause (&arg);
- if ((*arg != '\0') && !isspace (*arg))
+ if ((*arg != '\0') && !isspace ((int) *arg))
error (_("Junk at end of arguments."));
if ((ex_event != EX_EVENT_THROW) &&
Index: coffread.c
===================================================================
RCS file: /cvs/src/src/gdb/coffread.c,v
retrieving revision 1.66
diff -p -u -r1.66 coffread.c
--- coffread.c 9 Jan 2007 17:58:50 -0000 1.66
+++ coffread.c 6 Apr 2007 22:06:45 -0000
@@ -220,7 +220,7 @@ coff_locate_sections (bfd *abfd, asectio
/* We can have multiple .stab sections if linked with
--split-by-reloc. */
for (s = name + sizeof ".stab" - 1; *s != '\0'; s++)
- if (!isdigit (*s))
+ if (!isdigit ((int) *s))
break;
if (*s == '\0')
{
Index: completer.c
===================================================================
RCS file: /cvs/src/src/gdb/completer.c,v
retrieving revision 1.18
diff -p -u -r1.18 completer.c
--- completer.c 9 Jan 2007 17:58:50 -0000 1.18
+++ completer.c 6 Apr 2007 22:06:45 -0000
@@ -437,7 +437,7 @@ complete_line (const char *text, char *l
/* lookup_cmd_1 advances p up to the first ambiguous thing, but
doesn't advance over that thing itself. Do so now. */
q = p;
- while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
+ while (*q && (isalnum ((int) *q) || *q == '-' || *q == '_'))
++q;
if (q != tmp_command + point)
{
@@ -543,7 +543,7 @@ complete_line (const char *text, char *l
q = p;
while (q > tmp_command)
{
- if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
+ if (isalnum ((int) q[-1]) || q[-1] == '-' || q[-1] == '_')
--q;
else
break;
Index: cp-support.c
===================================================================
RCS file: /cvs/src/src/gdb/cp-support.c,v
retrieving revision 1.23
diff -p -u -r1.23 cp-support.c
--- cp-support.c 21 Jan 2007 16:55:49 -0000 1.23
+++ cp-support.c 6 Apr 2007 22:06:45 -0000
@@ -513,7 +513,7 @@ cp_find_first_component_aux (const char
&& strncmp (name + index, "operator", LENGTH_OF_OPERATOR) == 0)
{
index += LENGTH_OF_OPERATOR;
- while (isspace(name[index]))
+ while (isspace((int) name[index]))
++index;
switch (name[index])
{
Index: exec.c
===================================================================
RCS file: /cvs/src/src/gdb/exec.c,v
retrieving revision 1.65
diff -p -u -r1.65 exec.c
--- exec.c 9 Feb 2007 20:11:47 -0000 1.65
+++ exec.c 6 Apr 2007 22:06:45 -0000
@@ -645,7 +645,7 @@ set_section_command (char *args, int fro
error (_("Must specify section name and its virtual address"));
/* Parse out section name */
- for (secname = args; !isspace (*args); args++);
+ for (secname = args; !isspace ((int) *args); args++);
seclen = args - secname;
/* Parse out new virtual address */
Index: expprint.c
===================================================================
RCS file: /cvs/src/src/gdb/expprint.c,v
retrieving revision 1.26
diff -p -u -r1.26 expprint.c
--- expprint.c 9 Jan 2007 17:58:50 -0000 1.26
+++ expprint.c 6 Apr 2007 22:06:45 -0000
@@ -809,7 +809,7 @@ dump_raw_expression (struct expression *
eltscan++)
{
fprintf_filtered (stream, "%c",
- isprint (*eltscan) ? (*eltscan & 0xFF) : '.');
+ isprint ((int) (*eltscan ? *eltscan & 0xFF : '.')));
}
fprintf_filtered (stream, "\n");
}
Index: gnu-v2-abi.c
===================================================================
RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v
retrieving revision 1.24
diff -p -u -r1.24 gnu-v2-abi.c
--- gnu-v2-abi.c 9 Jan 2007 17:58:51 -0000 1.24
+++ gnu-v2-abi.c 6 Apr 2007 22:06:45 -0000
@@ -53,7 +53,7 @@ static enum ctor_kinds
gnuv2_is_constructor_name (const char *name)
{
if ((name[0] == '_' && name[1] == '_'
- && (isdigit (name[2]) || strchr ("Qt", name[2])))
+ && (isdigit ((int) name[2]) || strchr ("Qt", name[2])))
|| strncmp (name, "__ct__", 6) == 0)
return complete_object_ctor;
else
Index: infcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/infcmd.c,v
retrieving revision 1.151
diff -p -u -r1.151 infcmd.c
--- infcmd.c 27 Mar 2007 23:01:00 -0000 1.151
+++ infcmd.c 6 Apr 2007 22:06:46 -0000
@@ -1701,7 +1701,7 @@ registers_info (char *addr_exp, int fpre
const char *end;
/* Keep skipping leading white space. */
- if (isspace ((*addr_exp)))
+ if (isspace ((int) *addr_exp))
{
addr_exp++;
continue;
@@ -1711,12 +1711,12 @@ registers_info (char *addr_exp, int fpre
resembling a register following it. */
if (addr_exp[0] == '$')
addr_exp++;
- if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
+ if (isspace ((int) *addr_exp) || *addr_exp == '\0')
error (_("Missing register name"));
/* Find the start/end of this register name/num/group. */
start = addr_exp;
- while ((*addr_exp) != '\0' && !isspace ((*addr_exp)))
+ while ((*addr_exp) != '\0' && !isspace ((int) *addr_exp))
addr_exp++;
end = addr_exp;
Index: infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.225
diff -p -u -r1.225 infrun.c
--- infrun.c 29 Mar 2007 07:35:39 -0000 1.225
+++ infrun.c 6 Apr 2007 22:06:46 -0000
@@ -3350,7 +3350,7 @@ handle_command (char *args, int from_tty
while (*argv != NULL)
{
wordlen = strlen (*argv);
- for (digits = 0; isdigit ((*argv)[digits]); digits++)
+ for (digits = 0; isdigit ((int) (*argv)[digits]); digits++)
{;
}
allsigs = 0;
Index: jv-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/jv-exp.y,v
retrieving revision 1.24
diff -p -u -r1.24 jv-exp.y
--- jv-exp.y 9 Jan 2007 17:58:51 -0000 1.24
+++ jv-exp.y 6 Apr 2007 22:06:46 -0000
@@ -724,7 +724,7 @@ parse_number (p, len, parsed_float, puti
if (c == 'f' || c == 'F')
putithere->typed_val_float.type = builtin_type_float;
- else if (isdigit (c) || c == '.' || c == 'd' || c == 'D')
+ else if (isdigit ((int) c) || c == '.' || c == 'd' || c == 'D')
putithere->typed_val_float.type = builtin_type_double;
else
return ERROR;
Index: main.c
===================================================================
RCS file: /cvs/src/src/gdb/main.c,v
retrieving revision 1.62
diff -p -u -r1.62 main.c
--- main.c 9 Jan 2007 21:34:29 -0000 1.62
+++ main.c 6 Apr 2007 22:06:46 -0000
@@ -736,7 +736,7 @@ extern int gdbtk_test (char *);
If its first character is a digit, try attach first
and then corefile. Otherwise try corefile first. */
- if (isdigit (corearg[0]))
+ if (isdigit ((int) corearg[0]))
{
if (catch_command_errors (attach_command, corearg,
!batch, RETURN_MASK_ALL) == 0)
Index: maint.c
===================================================================
RCS file: /cvs/src/src/gdb/maint.c,v
retrieving revision 1.59
diff -p -u -r1.59 maint.c
--- maint.c 9 Jan 2007 17:58:52 -0000 1.59
+++ maint.c 6 Apr 2007 22:06:46 -0000
@@ -455,14 +455,14 @@ maintenance_translate_address (char *arg
sect = NULL;
p = arg;
- if (!isdigit (*p))
+ if (!isdigit ((int) *p))
{ /* See if we have a valid section name */
- while (*p && !isspace (*p)) /* Find end of section name */
+ while (*p && !isspace ((int) *p)) /* Find end of section name */
p++;
if (*p == '\000') /* End of command? */
error (_("Need to specify <section-name> and <address>"));
*p++ = '\000';
- while (isspace (*p))
+ while (isspace ((int) *p))
p++; /* Skip whitespace */
ALL_OBJFILES (objfile)
Index: minsyms.c
===================================================================
RCS file: /cvs/src/src/gdb/minsyms.c,v
retrieving revision 1.49
diff -p -u -r1.49 minsyms.c
--- minsyms.c 9 Jan 2007 22:14:35 -0000 1.49
+++ minsyms.c 6 Apr 2007 22:06:46 -0000
@@ -83,7 +83,7 @@ msymbol_hash_iw (const char *string)
unsigned int hash = 0;
while (*string && *string != '(')
{
- while (isspace (*string))
+ while (isspace ((int) *string))
++string;
if (*string && *string != '(')
{
Index: objc-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/objc-exp.y,v
retrieving revision 1.23
diff -p -u -r1.23 objc-exp.y
--- objc-exp.y 9 Jan 2007 17:58:55 -0000 1.23
+++ objc-exp.y 6 Apr 2007 22:06:46 -0000
@@ -1034,7 +1034,7 @@ parse_number (p, len, parsed_float, puti
putithere->typed_val_float.type = builtin_type_float;
else if (c == 'l')
putithere->typed_val_float.type = builtin_type_long_double;
- else if (isdigit (c) || c == '.')
+ else if (isdigit ((int) c) || c == '.')
putithere->typed_val_float.type = builtin_type_double;
else
return ERROR;
Index: objc-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/objc-lang.c,v
retrieving revision 1.52
diff -p -u -r1.52 objc-lang.c
--- objc-lang.c 9 Jan 2007 17:58:55 -0000 1.52
+++ objc-lang.c 6 Apr 2007 22:06:46 -0000
@@ -1131,23 +1131,23 @@ parse_selector (char *method, char **sel
s1 = method;
- while (isspace (*s1))
+ while (isspace ((int) *s1))
s1++;
if (*s1 == '\'')
{
found_quote = 1;
s1++;
}
- while (isspace (*s1))
+ while (isspace ((int) *s1))
s1++;
nselector = s1;
s2 = s1;
for (;;) {
- if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
+ if (isalnum ((int) *s2) || (*s2 == '_') || (*s2 == ':'))
*s1++ = *s2;
- else if (isspace (*s2))
+ else if (isspace ((int) *s2))
;
else if ((*s2 == '\0') || (*s2 == '\''))
break;
@@ -1157,13 +1157,13 @@ parse_selector (char *method, char **sel
}
*s1++ = '\0';
- while (isspace (*s2))
+ while (isspace ((int) *s2))
s2++;
if (found_quote)
{
if (*s2 == '\'')
s2++;
- while (isspace (*s2))
+ while (isspace ((int) *s2))
s2++;
}
@@ -1193,20 +1193,20 @@ parse_method (char *method, char *type,
s1 = method;
- while (isspace (*s1))
+ while (isspace ((int) *s1))
s1++;
if (*s1 == '\'')
{
found_quote = 1;
s1++;
}
- while (isspace (*s1))
+ while (isspace ((int) *s1))
s1++;
if ((s1[0] == '+') || (s1[0] == '-'))
ntype = *s1++;
- while (isspace (*s1))
+ while (isspace ((int) *s1))
s1++;
if (*s1 != '[')
@@ -1214,20 +1214,20 @@ parse_method (char *method, char *type,
s1++;
nclass = s1;
- while (isalnum (*s1) || (*s1 == '_'))
+ while (isalnum ((int) *s1) || (*s1 == '_'))
s1++;
s2 = s1;
- while (isspace (*s2))
+ while (isspace ((int) *s2))
s2++;
if (*s2 == '(')
{
s2++;
- while (isspace (*s2))
+ while (isspace ((int) *s2))
s2++;
ncategory = s2;
- while (isalnum (*s2) || (*s2 == '_'))
+ while (isalnum ((int) *s2) || (*s2 == '_'))
s2++;
*s2++ = '\0';
}
@@ -1239,9 +1239,9 @@ parse_method (char *method, char *type,
s1 = s2;
for (;;) {
- if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
+ if (isalnum ((int) *s2) || (*s2 == '_') || (*s2 == ':'))
*s1++ = *s2;
- else if (isspace (*s2))
+ else if (isspace ((int) *s2))
;
else if (*s2 == ']')
break;
@@ -1252,14 +1252,14 @@ parse_method (char *method, char *type,
*s1++ = '\0';
s2++;
- while (isspace (*s2))
+ while (isspace ((int) *s2))
s2++;
if (found_quote)
{
if (*s2 != '\'')
return NULL;
s2++;
- while (isspace (*s2))
+ while (isspace ((int) *s2))
s2++;
}
Index: p-exp.y
===================================================================
RCS file: /cvs/src/src/gdb/p-exp.y,v
retrieving revision 1.34
diff -p -u -r1.34 p-exp.y
--- p-exp.y 9 Jan 2007 17:58:55 -0000 1.34
+++ p-exp.y 6 Apr 2007 22:06:46 -0000
@@ -809,7 +809,7 @@ parse_number (p, len, parsed_float, puti
putithere->typed_val_float.type = builtin_type_float;
else if (c == 'l')
putithere->typed_val_float.type = builtin_type_long_double;
- else if (isdigit (c) || c == '.')
+ else if (isdigit ((int) c) || c == '.')
putithere->typed_val_float.type = builtin_type_double;
else
return ERROR;
@@ -1072,8 +1072,9 @@ yylex ()
if (explen > 2)
for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++)
if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0
- && (!isalpha (tokentab3[i].operator[0]) || explen == 3
- || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_')))
+ && (!isalpha ((int) tokentab3[i].operator[0]) || explen == 3
+ || (!isalpha ((int) tokstart[3])
+ && !isdigit ((int) tokstart[3]) && tokstart[3] != '_')))
{
lexptr += 3;
yylval.opcode = tokentab3[i].opcode;
@@ -1084,8 +1085,9 @@ yylex ()
if (explen > 1)
for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++)
if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0
- && (!isalpha (tokentab2[i].operator[0]) || explen == 2
- || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_')))
+ && (!isalpha ((int) tokentab2[i].operator[0]) || explen == 2
+ || (!isalpha ((int) tokstart[2])
+ && !isdigit ((int) tokstart[2]) && tokstart[2] != '_')))
{
lexptr += 2;
yylval.opcode = tokentab2[i].opcode;
Index: p-typeprint.c
===================================================================
RCS file: /cvs/src/src/gdb/p-typeprint.c,v
retrieving revision 1.18
diff -p -u -r1.18 p-typeprint.c
--- p-typeprint.c 9 Jan 2007 17:58:55 -0000 1.18
+++ p-typeprint.c 6 Apr 2007 22:06:46 -0000
@@ -157,9 +157,9 @@ pascal_type_print_method_args (char *phy
char *argname;
fputs_filtered (" (", stream);
/* we must demangle this */
- while (isdigit (physname[0]))
+ while (isdigit ((int) physname[0]))
{
- while (isdigit (physname[len]))
+ while (isdigit ((int) physname[len]))
{
len++;
}
Index: parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.57
diff -p -u -r1.57 parse.c
--- parse.c 27 Feb 2007 19:46:04 -0000 1.57
+++ parse.c 6 Apr 2007 22:06:46 -0000
@@ -641,10 +641,10 @@ parse_nested_classes_for_hpacc (char *na
/* Get to the end of the next namespace or class spec. */
/* If we're looking at some non-token, fail immediately */
start = p;
- if (!(isalpha (*p) || *p == '$' || *p == '_'))
+ if (!(isalpha ((int) *p) || *p == '$' || *p == '_'))
return (struct symbol *) NULL;
p++;
- while (*p && (isalnum (*p) || *p == '$' || *p == '_'))
+ while (*p && (isalnum ((int) *p) || *p == '$' || *p == '_'))
p++;
if (*p == '<')
@@ -667,7 +667,7 @@ parse_nested_classes_for_hpacc (char *na
p++;
/* Done with tokens? */
- if (!*p || !(isalpha (*p) || *p == '$' || *p == '_'))
+ if (!*p || !(isalpha ((int) *p) || *p == '$' || *p == '_'))
done = 1;
tmp = (char *) alloca (prefix_len + end - start + 3);
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/remote-utils.c,v
retrieving revision 1.21
diff -p -u -r1.21 remote-utils.c
--- remote-utils.c 9 Jan 2007 17:58:56 -0000 1.21
+++ remote-utils.c 6 Apr 2007 22:06:47 -0000
@@ -113,10 +113,10 @@ sr_scan_args (char *proto, char *args)
return;
/* scan off white space. */
- for (p = args; isspace (*p); ++p);;
+ for (p = args; isspace ((int) *p); ++p);;
/* find end of device name. */
- for (q = p; *q != '\0' && !isspace (*q); ++q);;
+ for (q = p; *q != '\0' && !isspace ((int) *q); ++q);;
/* check for missing or empty device name. */
CHECKDONE (p, q);
@@ -137,7 +137,7 @@ sr_scan_args (char *proto, char *args)
sr_set_debug (n);
/* scan off remaining white space. */
- for (p = q; isspace (*p); ++p);;
+ for (p = q; isspace ((int) *p); ++p);;
/* if not end of string, then there's unrecognized junk. */
if (*p != '\0')
Index: remote.c
===================================================================
RCS file: /cvs/src/src/gdb/remote.c,v
retrieving revision 1.247
diff -p -u -r1.247 remote.c
--- remote.c 27 Mar 2007 19:11:10 -0000 1.247
+++ remote.c 6 Apr 2007 22:06:47 -0000
@@ -811,7 +811,7 @@ packet_check_result (const char *buf)
/* The stub recognized the packet request. Check that the
operation succeeded. */
if (buf[0] == 'E'
- && isxdigit (buf[1]) && isxdigit (buf[2])
+ && isxdigit ((int) buf[1]) && isxdigit ((int) buf[2])
&& buf[3] == '\0')
/* "Enn" - definitly an error. */
return PACKET_ERROR;
@@ -4342,7 +4342,7 @@ remote_read_bytes (CORE_ADDR memaddr, gd
getpkt (&rs->buf, &rs->buf_size, 0);
if (rs->buf[0] == 'E'
- && isxdigit (rs->buf[1]) && isxdigit (rs->buf[2])
+ && isxdigit ((int) rs->buf[1]) && isxdigit ((int) rs->buf[2])
&& rs->buf[3] == '\0')
{
/* There is no correspondance between what the remote
@@ -5716,7 +5716,7 @@ remote_xfer_partial (struct target_ops *
while (annex[i] && (i < (get_remote_packet_size () - 8)))
{
/* Bad caller may have sent forbidden characters. */
- gdb_assert (isprint (annex[i]) && annex[i] != '$' && annex[i] != '#');
+ gdb_assert (isprint ((int) annex[i]) && annex[i] != '$' && annex[i] != '#');
*p2++ = annex[i];
i++;
}
@@ -5779,7 +5779,7 @@ remote_rcmd (char *command,
if (strcmp (buf, "OK") == 0)
break;
if (strlen (buf) == 3 && buf[0] == 'E'
- && isdigit (buf[1]) && isdigit (buf[2]))
+ && isdigit ((int) buf[1]) && isdigit ((int) buf[2]))
{
error (_("Protocol error with Rcmd"));
}
Index: serial.c
===================================================================
RCS file: /cvs/src/src/gdb/serial.c,v
retrieving revision 1.28
diff -p -u -r1.28 serial.c
--- serial.c 9 Jan 2007 17:58:58 -0000 1.28
+++ serial.c 6 Apr 2007 22:06:47 -0000
@@ -191,7 +191,7 @@ serial_open (const char *name)
ops = serial_interface_lookup ("pipe");
/* Discard ``|'' and any space before the command itself. */
++open_name;
- while (isspace (*open_name))
+ while (isspace ((int) *open_name))
++open_name;
}
/* Check for a colon, suggesting an IP address/port pair.
Index: stabsread.c
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.c,v
retrieving revision 1.88
diff -p -u -r1.88 stabsread.c
--- stabsread.c 29 Mar 2007 18:33:58 -0000 1.88
+++ stabsread.c 6 Apr 2007 22:06:47 -0000
@@ -554,7 +554,7 @@ process_reference (char **string)
p = *string + 1;
/* Read number as reference id. */
- while (*p && isdigit (*p))
+ while (*p && isdigit ((int) *p))
{
refnum = refnum * 10 + *p - '0';
p++;
@@ -707,7 +707,7 @@ define_symbol (CORE_ADDR valu, char *str
deftypes we know how to handle is a local. */
if (!strchr ("cfFGpPrStTvVXCR", *p))
#else
- if (isdigit (*p) || *p == '(' || *p == '-')
+ if (isdigit ((int) *p) || *p == '(' || *p == '-')
#endif
deftype = 'l';
else
@@ -1765,7 +1765,7 @@ again:
break;
case '@':
- if (isdigit (**pp) || **pp == '(' || **pp == '-')
+ if (isdigit ((int) **pp) || **pp == '(' || **pp == '-')
{ /* Member (class & variable) type */
/* FIXME -- we should be doing smash_to_XXX types here. */
Index: stack.c
===================================================================
RCS file: /cvs/src/src/gdb/stack.c,v
retrieving revision 1.143
diff -p -u -r1.143 stack.c
--- stack.c 29 Mar 2007 07:35:39 -0000 1.143
+++ stack.c 6 Apr 2007 22:06:48 -0000
@@ -720,14 +720,14 @@ parse_frame_specification_1 (const char
const char *p;
/* Skip leading white space, bail of EOL. */
- while (isspace (*frame_exp))
+ while (isspace ((int) *frame_exp))
frame_exp++;
if (!*frame_exp)
break;
/* Parse the argument, extract it, save it. */
for (p = frame_exp;
- *p && !isspace (*p);
+ *p && !isspace ((int) *p);
p++);
addr_string = savestring (frame_exp, p - frame_exp);
frame_exp = p;
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.182
diff -p -u -r1.182 symfile.c
--- symfile.c 26 Feb 2007 20:04:38 -0000 1.182
+++ symfile.c 6 Apr 2007 22:06:48 -0000
@@ -2414,7 +2414,7 @@ set_ext_lang_command (char *args, int fr
error (_("'%s': Filename extension must begin with '.'"), ext_args);
/* Find end of first arg. */
- while (*cp && !isspace (*cp))
+ while (*cp && !isspace ((int) *cp))
cp++;
if (*cp == '\0')
@@ -2425,7 +2425,7 @@ set_ext_lang_command (char *args, int fr
*cp++ = '\0';
/* Find beginning of second arg, which should be a source language. */
- while (*cp && isspace (*cp))
+ while (*cp && isspace ((int) *cp))
cp++;
if (*cp == '\0')
Index: symtab.c
===================================================================
RCS file: /cvs/src/src/gdb/symtab.c,v
retrieving revision 1.156
diff -p -u -r1.156 symtab.c
--- symtab.c 28 Mar 2007 00:12:15 -0000 1.156
+++ symtab.c 6 Apr 2007 22:06:49 -0000
@@ -2568,7 +2568,7 @@ operator_chars (char *p, char **end)
/* Don't get faked out by `operator' being part of a longer
identifier. */
- if (isalpha (*p) || *p == '_' || *p == '$' || *p == '\0')
+ if (isalpha ((int) *p) || *p == '_' || *p == '$' || *p == '\0')
return *end;
/* Allow some whitespace between `operator' and the operator symbol. */
@@ -2577,10 +2577,10 @@ operator_chars (char *p, char **end)
/* Recognize 'operator TYPENAME'. */
- if (isalpha (*p) || *p == '_' || *p == '$')
+ if (isalpha ((int) *p) || *p == '_' || *p == '$')
{
char *q = p + 1;
- while (isalnum (*q) || *q == '_' || *q == '$')
+ while (isalnum ((int) *q) || *q == '_' || *q == '$')
q++;
*end = q;
return p;
@@ -2968,7 +2968,7 @@ search_symbols (char *regexp, domain_enu
if (*opname)
{
int fix = -1; /* -1 means ok; otherwise number of spaces needed. */
- if (isalpha (*opname) || *opname == '_' || *opname == '$')
+ if (isalpha ((int) *opname) || *opname == '_' || *opname == '$')
{
/* There should 1 space between 'operator' and 'TYPENAME'. */
if (opname[-1] != ' ' || opname[-2] == ' ')
@@ -3510,7 +3510,7 @@ language_search_unquoted_string (char *t
{
for (; p > text; --p)
{
- if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
+ if (isalnum ((int) p[-1]) || p[-1] == '_' || p[-1] == '\0')
continue;
else
{
@@ -3530,7 +3530,7 @@ language_search_unquoted_string (char *t
Unfortunately we have to find it now to decide. */
while (t > text)
- if (isalnum (t[-1]) || t[-1] == '_' ||
+ if (isalnum ((int) t[-1]) || t[-1] == '_' ||
t[-1] == ' ' || t[-1] == ':' ||
t[-1] == '(' || t[-1] == ')')
--t;
@@ -3617,7 +3617,7 @@ make_symbol_completion_list (char *text,
which are in symbols. */
while (p > text)
{
- if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
+ if (isalnum ((int) p[-1]) || p[-1] == '_' || p[-1] == '\0')
--p;
else
break;
Index: thread.c
===================================================================
RCS file: /cvs/src/src/gdb/thread.c,v
retrieving revision 1.52
diff -p -u -r1.52 thread.c
--- thread.c 30 Mar 2007 12:57:43 -0000 1.52
+++ thread.c 6 Apr 2007 22:06:49 -0000
@@ -584,7 +584,7 @@ thread_apply_command (char *tidlist, int
if (tidlist == NULL || *tidlist == '\000')
error (_("Please specify a thread ID list"));
- for (cmd = tidlist; *cmd != '\000' && !isalpha (*cmd); cmd++);
+ for (cmd = tidlist; *cmd != '\000' && !isalpha ((int) *cmd); cmd++);
if (*cmd == '\000')
error (_("Please specify a command following the thread ID list"));
Index: utils.c
===================================================================
RCS file: /cvs/src/src/gdb/utils.c,v
retrieving revision 1.176
diff -p -u -r1.176 utils.c
--- utils.c 30 Mar 2007 09:31:31 -0000 1.176
+++ utils.c 6 Apr 2007 22:06:49 -0000
@@ -2310,11 +2310,11 @@ strcmp_iw (const char *string1, const ch
{
while ((*string1 != '\0') && (*string2 != '\0'))
{
- while (isspace (*string1))
+ while (isspace ((int) *string1))
{
string1++;
}
- while (isspace (*string2))
+ while (isspace ((int) *string2))
{
string2++;
}
@@ -2369,11 +2369,11 @@ strcmp_iw_ordered (const char *string1,
{
while ((*string1 != '\0') && (*string2 != '\0'))
{
- while (isspace (*string1))
+ while (isspace ((int) *string1))
{
string1++;
}
- while (isspace (*string2))
+ while (isspace ((int) *string2))
{
string2++;
}
@@ -2846,9 +2846,9 @@ string_to_core_addr (const char *my_stri
int i;
for (i = 2; my_string[i] != '\0'; i++)
{
- if (isdigit (my_string[i]))
+ if (isdigit ((int) my_string[i]))
addr = (my_string[i] - '0') + (addr * 16);
- else if (isxdigit (my_string[i]))
+ else if (isxdigit ((int) my_string[i]))
addr = (tolower (my_string[i]) - 'a' + 0xa) + (addr * 16);
else
error (_("invalid hex \"%s\""), my_string);
@@ -2860,7 +2860,7 @@ string_to_core_addr (const char *my_stri
int i;
for (i = 0; my_string[i] != '\0'; i++)
{
- if (isdigit (my_string[i]))
+ if (isdigit ((int) my_string[i]))
addr = (my_string[i] - '0') + (addr * 10);
else
error (_("invalid decimal \"%s\""), my_string);
@@ -3136,7 +3136,7 @@ strtoulst (const char *num, const char *
int i = 0;
/* Skip leading whitespace. */
- while (isspace (num[i]))
+ while (isspace ((int) num[i]))
i++;
/* Handle prefixes. */
Index: cli/cli-cmds.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v
retrieving revision 1.70
diff -p -u -r1.70 cli-cmds.c
--- cli/cli-cmds.c 27 Feb 2007 19:46:04 -0000 1.70
+++ cli/cli-cmds.c 6 Apr 2007 22:06:49 -0000
@@ -499,17 +499,17 @@ source_command (char *args, int from_tty
if (args)
{
/* Make sure leading white space does not break the comparisons. */
- while (isspace(args[0]))
+ while (isspace((int) args[0]))
args++;
/* Is -v the first thing in the string? */
- if (args[0] == '-' && args[1] == 'v' && isspace (args[2]))
+ if (args[0] == '-' && args[1] == 'v' && isspace ((int) args[2]))
{
source_verbose = 1;
/* Trim -v and whitespace from the filename. */
file = &args[3];
- while (isspace (file[0]))
+ while (isspace ((int) file[0]))
file++;
}
}
Index: cli/cli-decode.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v
retrieving revision 1.60
diff -p -u -r1.60 cli-decode.c
--- cli/cli-decode.c 9 Jan 2007 17:59:00 -0000 1.60
+++ cli/cli-decode.c 6 Apr 2007 22:06:49 -0000
@@ -925,7 +925,7 @@ print_doc_line (struct ui_file *stream,
}
strncpy (line_buffer, str, p - str);
line_buffer[p - str] = '\0';
- if (islower (line_buffer[0]))
+ if (islower ((int) line_buffer[0]))
line_buffer[0] = toupper (line_buffer[0]);
ui_out_text (uiout, line_buffer);
}
@@ -1027,7 +1027,7 @@ find_command_name_length (const char *te
used as a suffix for print, examine and display.
Note that this is larger than the character set allowed when creating
user-defined commands. */
- while (isalnum (*p) || *p == '-' || *p == '_' ||
+ while (isalnum ((int) *p) || *p == '-' || *p == '_' ||
/* Characters used by TUI specific commands. */
*p == '+' || *p == '<' || *p == '>' || *p == '$' ||
/* Characters used for XDB compatibility. */
@@ -1118,7 +1118,7 @@ lookup_cmd_1 (char **text, struct cmd_li
for (tmp = 0; tmp < len; tmp++)
{
char x = command[tmp];
- command[tmp] = isupper (x) ? tolower (x) : x;
+ command[tmp] = isupper ((int) x) ? tolower (x) : x;
}
found = find_cmd (command, len, clist, ignore_help_classes, &nfound);
}
@@ -1474,7 +1474,7 @@ lookup_cmd_composition (char *text,
for (tmp = 0; tmp < len; tmp++)
{
char x = command[tmp];
- command[tmp] = isupper (x) ? tolower (x) : x;
+ command[tmp] = isupper ((int) x) ? tolower (x) : x;
}
*cmd = find_cmd (command, len, cur_list, 1, &nfound);
}
Index: cli/cli-dump.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-dump.c,v
retrieving revision 1.26
diff -p -u -r1.26 cli-dump.c
--- cli/cli-dump.c 8 Mar 2007 16:54:02 -0000 1.26
+++ cli/cli-dump.c 6 Apr 2007 22:06:49 -0000
@@ -41,7 +41,7 @@ skip_spaces (char *chp)
{
if (chp == NULL)
return NULL;
- while (isspace (*chp))
+ while (isspace ((int) *chp))
chp++;
return chp;
}
Index: cli/cli-script.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-script.c,v
retrieving revision 1.40
diff -p -u -r1.40 cli-script.c
--- cli/cli-script.c 27 Jan 2007 12:30:46 -0000 1.40
+++ cli/cli-script.c 6 Apr 2007 22:06:49 -0000
@@ -683,7 +683,7 @@ locate_arg (char *p)
while ((p = strchr (p, '$')))
{
if (strncmp (p, "$arg", 4) == 0
- && (isdigit (p[4]) || p[4] == 'c'))
+ && (isdigit ((int) p[4]) || p[4] == 'c'))
return p;
p++;
}
@@ -866,7 +866,7 @@ read_next_line (struct command_line **co
{
char *first_arg;
first_arg = p + 5;
- while (first_arg < p1 && isspace (*first_arg))
+ while (first_arg < p1 && isspace ((int) *first_arg))
first_arg++;
*command = build_command_line (while_control, first_arg);
}
@@ -874,7 +874,7 @@ read_next_line (struct command_line **co
{
char *first_arg;
first_arg = p + 2;
- while (first_arg < p1 && isspace (*first_arg))
+ while (first_arg < p1 && isspace ((int) *first_arg))
first_arg++;
*command = build_command_line (if_control, first_arg);
}
@@ -882,7 +882,7 @@ read_next_line (struct command_line **co
{
char *first_arg;
first_arg = p + 8;
- while (first_arg < p1 && isspace (*first_arg))
+ while (first_arg < p1 && isspace ((int) *first_arg))
first_arg++;
*command = build_command_line (commands_control, first_arg);
}
@@ -1205,7 +1205,7 @@ validate_comname (char *comname)
p = comname;
while (*p)
{
- if (!isalnum (*p) && *p != '-' && *p != '_')
+ if (!isalnum ((int) *p) && *p != '-' && *p != '_')
error (_("Junk in argument list: \"%s\""), p);
p++;
}
@@ -1294,7 +1294,7 @@ define_command (char *comname, int from_
/* If the rest of the commands will be case insensitive, this one
should behave in the same manner. */
for (tem = comname; *tem; tem++)
- if (isupper (*tem))
+ if (isupper ((int) *tem))
*tem = tolower (*tem);
sprintf (tmpbuf, "Type commands for definition of \"%s\".", comname);
Index: cli/cli-setshow.c
===================================================================
RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v
retrieving revision 1.29
diff -p -u -r1.29 cli-setshow.c
--- cli/cli-setshow.c 9 Jan 2007 17:59:00 -0000 1.29
+++ cli/cli-setshow.c 6 Apr 2007 22:06:49 -0000
@@ -40,7 +40,7 @@ parse_auto_binary_operation (const char
if (arg != NULL && *arg != '\0')
{
int length = strlen (arg);
- while (isspace (arg[length - 1]) && length > 0)
+ while (isspace ((int) arg[length - 1]) && length > 0)
length--;
if (strncmp (arg, "on", length) == 0
|| strncmp (arg, "1", length) == 0
Index: mi/mi-cmd-var.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v
retrieving revision 1.31
diff -p -u -r1.31 mi-cmd-var.c
--- mi/mi-cmd-var.c 27 Feb 2007 23:42:33 -0000 1.31
+++ mi/mi-cmd-var.c 6 Apr 2007 22:06:49 -0000
@@ -102,7 +102,7 @@ mi_cmd_var_create (char *command, char *
xfree (name);
name = varobj_gen_name ();
}
- else if (!isalpha (*name))
+ else if (!isalpha ((int) *name))
error (_("mi_cmd_var_create: name of object must begin with a letter"));
if (strcmp (frame, "*") == 0)
Index: mi/mi-parse.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-parse.c,v
retrieving revision 1.12
diff -p -u -r1.12 mi-parse.c
--- mi/mi-parse.c 9 Jan 2007 17:59:08 -0000 1.12
+++ mi/mi-parse.c 6 Apr 2007 22:06:49 -0000
@@ -39,7 +39,7 @@ mi_parse_argv (char *args, struct mi_par
{
char *arg;
/* skip leading white space */
- while (isspace (*chp))
+ while (isspace ((int) *chp))
chp++;
/* Three possibilities: EOF, quoted string, or other text. */
switch (*chp)
@@ -79,7 +79,7 @@ mi_parse_argv (char *args, struct mi_par
return;
}
/* Insist on trailing white space. */
- if (chp[1] != '\0' && !isspace (chp[1]))
+ if (chp[1] != '\0' && !isspace ((int) chp[1]))
{
freeargv (argv);
return;
@@ -110,7 +110,7 @@ mi_parse_argv (char *args, struct mi_par
characters into a buffer. */
int len;
char *start = chp;
- while (*chp != '\0' && !isspace (*chp))
+ while (*chp != '\0' && !isspace ((int) *chp))
{
chp++;
}
@@ -154,7 +154,7 @@ mi_parse (char *cmd)
memset (parse, 0, sizeof (*parse));
/* Before starting, skip leading white space. */
- while (isspace (*cmd))
+ while (isspace ((int) *cmd))
cmd++;
/* Find/skip any token and then extract it. */
@@ -167,7 +167,7 @@ mi_parse (char *cmd)
/* This wasn't a real MI command. Return it as a CLI_COMMAND. */
if (*chp != '-')
{
- while (isspace (*chp))
+ while (isspace ((int) *chp))
chp++;
parse->command = xstrdup (chp);
parse->op = CLI_COMMAND;
@@ -177,7 +177,7 @@ mi_parse (char *cmd)
/* Extract the command. */
{
char *tmp = chp + 1; /* discard ``-'' */
- for (; *chp && !isspace (*chp); chp++)
+ for (; *chp && !isspace ((int) *chp); chp++)
;
parse->command = xmalloc ((chp - tmp + 1) * sizeof (char *));
memcpy (parse->command, tmp, chp - tmp);
@@ -198,7 +198,7 @@ mi_parse (char *cmd)
}
/* Skip white space following the command. */
- while (isspace (*chp))
+ while (isspace ((int) *chp))
chp++;
/* For new argv commands, attempt to return the parsed argument
Index: tui/tui-win.c
===================================================================
RCS file: /cvs/src/src/gdb/tui/tui-win.c,v
retrieving revision 1.33
diff -p -u -r1.33 tui-win.c
--- tui/tui-win.c 27 Feb 2007 19:46:04 -0000 1.33
+++ tui/tui-win.c 6 Apr 2007 22:06:50 -0000
@@ -1501,7 +1501,7 @@ parse_scrolling_args (char *arg, struct
/* process the number of lines to scroll */
buf = buf_ptr = xstrdup (arg);
- if (isdigit (*buf_ptr))
+ if (isdigit ((int) *buf_ptr))
{
char *num_str;
^ permalink raw reply [flat|nested] 22+ messages in thread* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-06 22:34 Patch for isdigit/isalpha/etc. macro arguments Steve Ellcey @ 2007-04-06 23:06 ` Mark Kettenis 2007-04-06 23:17 ` Steve Ellcey 2007-04-06 23:36 ` Steve Ellcey 0 siblings, 2 replies; 22+ messages in thread From: Mark Kettenis @ 2007-04-06 23:06 UTC (permalink / raw) To: sje; +Cc: gdb-patches > Date: Fri, 6 Apr 2007 15:33:50 -0700 (PDT) > From: Steve Ellcey <sje@cup.hp.com> > > While getting gdb to build on hppa hp-ux I ran into an interesting > problem. I was building with gcc which means that the gdb makefile will > use -Wall and -Werror as options (a good thing in my opinion). The > problem I ran into is with the use of the isdigit, isalpha, isupper, > etc. macros. > > With GCC 4.1.1 and the -Wall -Werror options, if you access an array > with a char expression as the index instead of an int expression you get > an error. Sigh, another useless GCC warning that shouldn't be included in -Wall if you'd ask me. However... > HP-UX does not put the int cast in the array reference in the macros, so > if the argument to isdigit is not an int, you get an error (when using > gcc -Wall -Werror). This might indicate that HP-UX's isXXX() implementation is actually broken, because it will cause out-of-bounds access for characters that have the high bit set. > Here is a patch to cast the arguments to isalpha, etc. With this patch > and my previous HP-UX specific patch I was able to build gdb on hppa > hp-ux. > > Is this patch OK to checkin? Sorry, you obviously spent some serious amount of time fixing this, but I think this is just gross. It also would just hide the bug mentioned above. I guess we should use -liberty's "safe-ctype.h" instead. > 2007-04-06 Steve Ellcey <sje@cup.hp.com> > > * ada-exp.y: Cast idigit, islower, isupper, isalpha, etc. arg to int. > * ada-lang.c: Ditto. > * ada-lex.l: Ditto. > * ada-typeprint.c: Ditto. > * breakpoint.c: Ditto. > * coffread.c: Ditto. > * completer.c: Ditto. > * cp-support.c: Ditto. > * exec.c: Ditto. > * expprint.c: Ditto. > * gnu-v2-abi.c: Ditto. > * infcmd.c: Ditto. > * infrun.c: Ditto. > * jv-exp.y: Ditto. > * main.c: Ditto. > * maint.c: Ditto. > * minsyms.c: Ditto. > * objc-exp.y: Ditto. > * objc-lang.c: Ditto. > * p-exp.y: Ditto. > * p-typeprint.c: Ditto. > * parse.c: Ditto. > * remote-utils.c: Ditto. > * remote.c: Ditto. > * serial.c: Ditto. > * stabsread.c: Ditto. > * stack.c: Ditto. > * symfile.c: Ditto. > * symtab.c: Ditto. > * thread.c: Ditto. > * utils.c: Ditto. > * cli/cli-cmds.c: Ditto. > * cli/cli-decode.c: Ditto. > * cli/cli-dump.c: Ditto. > * cli/cli-script.c: Ditto. > * cli/cli-setshow.c: Ditto. > * mi/mi-cmd-var.c: Ditto. > * mi/mi-parse.c: Ditto. > * tui/tui-win.c: Ditto. > > > Index: ada-exp.y > =================================================================== > RCS file: /cvs/src/src/gdb/ada-exp.y,v > retrieving revision 1.20 > diff -p -u -r1.20 ada-exp.y > --- ada-exp.y 9 Jan 2007 17:58:49 -0000 1.20 > +++ ada-exp.y 6 Apr 2007 22:06:44 -0000 > @@ -908,7 +908,7 @@ write_object_renaming (struct block *ori > slice_state = LOWER_BOUND; > case 'S': > suffix += 1; > - if (isdigit (*suffix)) > + if (isdigit ((int) *suffix)) > { > char *next; > long val = strtol (suffix, &next, 10); > Index: ada-lang.c > =================================================================== > RCS file: /cvs/src/src/gdb/ada-lang.c,v > retrieving revision 1.95 > diff -p -u -r1.95 ada-lang.c > --- ada-lang.c 29 Mar 2007 21:57:01 -0000 1.95 > +++ ada-lang.c 6 Apr 2007 22:06:45 -0000 > @@ -738,7 +738,7 @@ is_suppressed_name (const char *str) > if (suffix == NULL) > suffix = str + strlen (str); > for (p = suffix - 1; p != str; p -= 1) > - if (isupper (*p)) > + if (isupper ((int) *p)) > { > int i; > if (p[0] == 'X' && p[-1] != '_') > @@ -840,7 +840,7 @@ ada_fold_name (const char *name) > static int > is_lower_alphanum (const char c) > { > - return (isdigit (c) || (isalpha (c) && islower (c))); > + return (isdigit ((int) c) || (isalpha ((int) c) && islower ((int) c))); > } > > /* Decode: > @@ -883,10 +883,10 @@ ada_decode (const char *encoded) > > /* Remove trailing .{DIGIT}+ or ___{DIGIT}+ or __{DIGIT}+. */ > len0 = strlen (encoded); > - if (len0 > 1 && isdigit (encoded[len0 - 1])) > + if (len0 > 1 && isdigit ((int) encoded[len0 - 1])) > { > i = len0 - 2; > - while (i > 0 && isdigit (encoded[i])) > + while (i > 0 && isdigit ((int) encoded[i])) > i--; > if (i >= 0 && encoded[i] == '.') > len0 = i; > @@ -910,7 +910,8 @@ ada_decode (const char *encoded) > > if (len0 > 1 > && encoded[len0 - 1] == 'N' > - && (isdigit (encoded[len0 - 2]) || islower (encoded[len0 - 2]))) > + && (isdigit ((int) encoded[len0 - 2]) > + || islower ((int) encoded[len0 - 2]))) > len0--; > > /* Remove the ___X.* suffix if present. Do not forget to verify that > @@ -936,11 +937,11 @@ ada_decode (const char *encoded) > GROW_VECT (decoding_buffer, decoding_buffer_size, 2 * len0 + 1); > decoded = decoding_buffer; > > - if (len0 > 1 && isdigit (encoded[len0 - 1])) > + if (len0 > 1 && isdigit ((int) encoded[len0 - 1])) > { > i = len0 - 2; > - while ((i >= 0 && isdigit (encoded[i])) > - || (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1]))) > + while ((i >= 0 && isdigit ((int) encoded[i])) > + || (i >= 1 && encoded[i] == '_' && isdigit ((int) encoded[i - 1]))) > i -= 1; > if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_') > len0 = i - 1; > @@ -948,7 +949,7 @@ ada_decode (const char *encoded) > len0 = i; > } > > - for (i = 0, j = 0; i < len0 && !isalpha (encoded[i]); i += 1, j += 1) > + for (i = 0, j = 0; i < len0 && !isalpha ((int) encoded[i]); i += 1, j += 1) > decoded[j] = encoded[i]; > > at_start_name = 1; > @@ -962,7 +963,7 @@ ada_decode (const char *encoded) > int op_len = strlen (ada_opname_table[k].encoded); > if ((strncmp (ada_opname_table[k].encoded + 1, encoded + i + 1, > op_len - 1) == 0) > - && !isalnum (encoded[i + op_len])) > + && !isalnum ((int) encoded[i + op_len])) > { > strcpy (decoded + j, ada_opname_table[k].decoded); > at_start_name = 0; > @@ -996,11 +997,11 @@ ada_decode (const char *encoded) > internally generated. */ > > if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E' > - && isdigit (encoded[i+2])) > + && isdigit ((int) encoded[i+2])) > { > int k = i + 3; > > - while (k < len0 && isdigit (encoded[k])) > + while (k < len0 && isdigit ((int) encoded[k])) > k++; > > if (k < len0 > @@ -1034,7 +1035,7 @@ ada_decode (const char *encoded) > i++; > } > > - if (encoded[i] == 'X' && i != 0 && isalnum (encoded[i - 1])) > + if (encoded[i] == 'X' && i != 0 && isalnum ((int) encoded[i - 1])) > { > do > i += 1; > @@ -1060,7 +1061,7 @@ ada_decode (const char *encoded) > decoded[j] = '\000'; > > for (i = 0; decoded[i] != '\0'; i += 1) > - if (isupper (decoded[i]) || decoded[i] == ' ') > + if (isupper ((int) decoded[i]) || decoded[i] == ' ') > goto Suppress; > > if (strcmp (decoded, encoded) == 0) > @@ -3134,9 +3135,9 @@ encoded_ordered_before (char *N0, char * > else > { > int k0, k1; > - for (k0 = strlen (N0) - 1; k0 > 0 && isdigit (N0[k0]); k0 -= 1) > + for (k0 = strlen (N0) - 1; k0 > 0 && isdigit ((int) N0[k0]); k0 -= 1) > ; > - for (k1 = strlen (N1) - 1; k1 > 0 && isdigit (N1[k1]); k1 -= 1) > + for (k1 = strlen (N1) - 1; k1 > 0 && isdigit ((int) N1[k1]); k1 -= 1) > ; > if ((N0[k0] == '_' || N0[k0] == '$') && N0[k0 + 1] != '\000' > && (N1[k1] == '_' || N1[k1] == '$') && N1[k1 + 1] != '\000') > @@ -3318,7 +3319,7 @@ get_selections (int *choices, int n_choi > char *args2; > int choice, j; > > - while (isspace (*args)) > + while (isspace ((int) *args)) > args += 1; > if (*args == '\0' && n_chosen == 0) > error_no_arg (_("one or more choice numbers")); > @@ -4715,10 +4716,10 @@ is_name_suffix (const char *str) > > /* (__[0-9]+)?\.[0-9]+ */ > matching = str; > - if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit (str[2])) > + if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit ((int) str[2])) > { > matching += 3; > - while (isdigit (matching[0])) > + while (isdigit ((int) matching[0])) > matching += 1; > if (matching[0] == '\0') > return 1; > @@ -4727,7 +4728,7 @@ is_name_suffix (const char *str) > if (matching[0] == '.' || matching[0] == '$') > { > matching += 1; > - while (isdigit (matching[0])) > + while (isdigit ((int) matching[0])) > matching += 1; > if (matching[0] == '\0') > return 1; > @@ -4737,7 +4738,7 @@ is_name_suffix (const char *str) > if (len > 3 && str[0] == '_' && str[1] == '_' && str[2] == '_') > { > matching = str + 3; > - while (isdigit (matching[0])) > + while (isdigit ((int) matching[0])) > matching += 1; > if (matching[0] == '\0') > return 1; > @@ -4761,10 +4762,10 @@ is_name_suffix (const char *str) > #endif > > /* _E[0-9]+[bs]$ */ > - if (len > 3 && str[0] == '_' && str [1] == 'E' && isdigit (str[2])) > + if (len > 3 && str[0] == '_' && str [1] == 'E' && isdigit ((int) str[2])) > { > matching = str + 3; > - while (isdigit (matching[0])) > + while (isdigit ((int) matching[0])) > matching += 1; > if ((matching[0] == 'b' || matching[0] == 's') > && matching [1] == '\0') > @@ -4812,17 +4813,17 @@ is_name_suffix (const char *str) > return 1; > return 0; > } > - if (!isdigit (str[2])) > + if (!isdigit ((int) str[2])) > return 0; > for (k = 3; str[k] != '\0'; k += 1) > - if (!isdigit (str[k]) && str[k] != '_') > + if (!isdigit ((int) str[k]) && str[k] != '_') > return 0; > return 1; > } > - if (str[0] == '$' && isdigit (str[1])) > + if (str[0] == '$' && isdigit ((int) str[1])) > { > for (k = 2; str[k] != '\0'; k += 1) > - if (!isdigit (str[k]) && str[k] != '_') > + if (!isdigit ((int) str[k]) && str[k] != '_') > return 0; > return 1; > } > @@ -4847,7 +4848,7 @@ is_dot_digits_suffix (const char *str) > return 0; > > str++; > - while (isdigit (str[0])) > + while (isdigit ((int) str[0])) > str++; > return (str[0] == '\0'); > } > @@ -4864,7 +4865,7 @@ is_valid_name_for_wild_match (const char > int i; > > for (i=0; decoded_name[i] != '\0'; i++) > - if (isalpha (decoded_name[i]) && !islower (decoded_name[i])) > + if (isalpha ((int) decoded_name[i]) && !islower ((int) decoded_name[i])) > return 0; > > return 1; > @@ -4947,14 +4948,14 @@ wild_match (const char *patn0, int patn_ > return 0; > if (name[0] == '_') > { > - if (!islower (name[2])) > + if (!islower ((int) name[2])) > return 0; > name += 2; > name_len -= 2; > } > else > { > - if (!islower (name[1])) > + if (!islower ((int) name[1])) > return 0; > name += 1; > name_len -= 1; > @@ -5240,7 +5241,7 @@ ada_tag_name_1 (void *args0) > return 0; > read_memory_string (value_as_address (val), name, sizeof (name) - 1); > for (p = name; *p != '\0'; p += 1) > - if (isalpha (*p)) > + if (isalpha ((int) *p)) > *p = tolower (*p); > args->name = name; > return 0; > @@ -5275,7 +5276,7 @@ ada_tag_name_2 (struct tag_args *args) > return 0; > read_memory_string (value_as_address (val), name, sizeof (name) - 1); > for (p = name; *p != '\0'; p += 1) > - if (isalpha (*p)) > + if (isalpha ((int) *p)) > *p = tolower (*p); > args->name = name; > return 0; > @@ -5449,14 +5450,14 @@ ada_scan_number (const char str[], int k > { > ULONGEST RU; > > - if (!isdigit (str[k])) > + if (!isdigit ((int) str[k])) > return 0; > > /* Do it the hard way so as not to make any assumption about > the relationship of unsigned long (%lu scan format code) and > LONGEST. */ > RU = 0; > - while (isdigit (str[k])) > + while (isdigit ((int) str[k])) > { > RU = RU * 10 + (str[k] - '0'); > k += 1; > @@ -6116,10 +6117,10 @@ field_alignment (struct type *type, int > int len = (name == NULL) ? 0 : strlen (name); > int align_offset; > > - if (!isdigit (name[len - 1])) > + if (!isdigit ((int) name[len - 1])) > return 1; > > - if (isdigit (name[len - 2])) > + if (isdigit ((int) name[len - 2])) > align_offset = len - 2; > else > align_offset = len - 1; > @@ -7228,7 +7229,7 @@ ada_enum_name (const char *name) > { > while ((tmp = strstr (name, "__")) != NULL) > { > - if (isdigit (tmp[2])) > + if (isdigit ((int) tmp[2])) > break; > else > name = tmp + 2; > @@ -9532,7 +9533,7 @@ ada_get_next_arg (char **argsp) > > /* Skip any leading white space. */ > > - while (isspace (*args)) > + while (isspace ((int) *args)) > args++; > > if (args[0] == '\0') > @@ -9541,7 +9542,7 @@ ada_get_next_arg (char **argsp) > /* Find the end of the current argument. */ > > end = args; > - while (*end != '\0' && !isspace (*end)) > + while (*end != '\0' && !isspace ((int) *end)) > end++; > > /* Adjust ARGSP to point to the start of the next argument. */ > @@ -9576,7 +9577,7 @@ catch_ada_exception_command_split (char > /* Check that we do not have any more arguments. Anything else > is unexpected. */ > > - while (isspace (*args)) > + while (isspace ((int) *args)) > args++; > > if (args[0] != '\0') > @@ -9797,7 +9798,7 @@ ada_decode_assert_location (char *args, > > if (args != NULL) > { > - while (isspace (*args)) > + while (isspace ((int) *args)) > args++; > if (*args != '\0') > error (_("Junk at end of arguments.")); > Index: ada-lex.l > =================================================================== > RCS file: /cvs/src/src/gdb/ada-lex.l,v > retrieving revision 1.17 > diff -p -u -r1.17 ada-lex.l > --- ada-lex.l 9 Jan 2007 17:58:49 -0000 1.17 > +++ ada-lex.l 6 Apr 2007 22:06:45 -0000 > @@ -330,7 +330,7 @@ processInt (const char *base0, const cha > result = strtoulst (num0, (const char **) &trailer, base); > if (errno == ERANGE) > error (_("Integer literal out of range")); > - if (isxdigit(*trailer)) > + if (isxdigit((int) *trailer)) > error (_("Invalid digit `%c' in based literal"), *trailer); > > while (exp > 0) > @@ -406,12 +406,12 @@ processId (const char *name0, int len) > int i0, i; > struct stoken result; > > - while (len > 0 && isspace (name0[len-1])) > + while (len > 0 && isspace ((int) name0[len-1])) > len -= 1; > i = i0 = 0; > while (i0 < len) > { > - if (isalnum (name0[i0])) > + if (isalnum ((int) name0[i0])) > { > name[i] = tolower (name0[i0]); > i += 1; i0 += 1; > @@ -510,9 +510,9 @@ find_dot_all (const char *str) > int i0 = i; > do > i += 1; > - while (isspace (str[i])); > + while (isspace ((int) str[i])); > if (strncmp (str+i, "all", 3) == 0 > - && ! isalnum (str[i+3]) && str[i+3] != '_') > + && ! isalnum ((int) str[i+3]) && str[i+3] != '_') > return i0; > } > } > Index: ada-typeprint.c > =================================================================== > RCS file: /cvs/src/src/gdb/ada-typeprint.c,v > retrieving revision 1.15 > diff -p -u -r1.15 ada-typeprint.c > --- ada-typeprint.c 9 Jan 2007 17:58:49 -0000 1.15 > +++ ada-typeprint.c 6 Apr 2007 22:06:45 -0000 > @@ -95,7 +95,7 @@ decoded_type_name (struct type *type) > if (s == name_buffer) > return name_buffer; > > - if (!islower (s[1])) > + if (!islower ((int) s[1])) > return NULL; > > for (s = q = name_buffer; *s != '\0'; q += 1) > Index: breakpoint.c > =================================================================== > RCS file: /cvs/src/src/gdb/breakpoint.c,v > retrieving revision 1.243 > diff -p -u -r1.243 breakpoint.c > --- breakpoint.c 27 Mar 2007 23:01:00 -0000 1.243 > +++ breakpoint.c 6 Apr 2007 22:06:45 -0000 > @@ -425,7 +425,7 @@ get_number_trailer (char **pp, int trail > char *start = ++p; > struct value *val; > > - while (isalnum (*p) || *p == '_') > + while (isalnum ((int) *p) || *p == '_') > p++; > varname = (char *) alloca (p - start + 1); > strncpy (varname, start, p - start); > @@ -457,14 +457,14 @@ get_number_trailer (char **pp, int trail > else > retval = atoi (*pp); > } > - if (!(isspace (*p) || *p == '\0' || *p == trailer)) > + if (!(isspace ((int) *p) || *p == '\0' || *p == trailer)) > { > /* Trailing junk: return 0 and let caller print error msg. */ > - while (!(isspace (*p) || *p == '\0' || *p == trailer)) > + while (!(isspace ((int) *p) || *p == '\0' || *p == trailer)) > ++p; > retval = 0; > } > - while (isspace (*p)) > + while (isspace ((int) *p)) > p++; > *pp = p; > return retval; > @@ -5145,7 +5145,7 @@ parse_breakpoint_sals (char **address, > /* If no arg given, or if first arg is 'if ', use the default > breakpoint. */ > if ((*address) == NULL > - || (strncmp ((*address), "if", 2) == 0 && isspace ((*address)[2]))) > + || (strncmp ((*address), "if", 2) == 0 && isspace ((int) (*address)[2]))) > { > if (default_breakpoint_valid) > { > @@ -5710,7 +5710,7 @@ stopin_command (char *arg, int from_tty) > if (hasColon) > badInput = (*argptr != ':'); /* Not a class::method */ > else > - badInput = isdigit (*arg); /* a simple line number */ > + badInput = isdigit ((int) *arg); /* a simple line number */ > } > > if (badInput) > @@ -5742,7 +5742,7 @@ stopat_command (char *arg, int from_tty) > if (hasColon) > badInput = (*argptr == ':'); /* we have class::method */ > else > - badInput = !isdigit (*arg); /* not a line number */ > + badInput = !isdigit ((int) *arg); /* not a line number */ > } > > if (badInput) > @@ -6145,7 +6145,7 @@ ep_skip_leading_whitespace (char **s) > { > if ((s == NULL) || (*s == NULL)) > return; > - while (isspace (**s)) > + while (isspace ((int) **s)) > *s += 1; > } > > @@ -6169,7 +6169,7 @@ ep_find_event_name_end (char *arg) > anything else delimites the token. */ > while (*s != '\0') > { > - if (!isalnum (*s) && (*s != '_')) > + if (!isalnum ((int) *s) && (*s != '_')) > break; > event_name_end = s; > s++; > @@ -6192,7 +6192,7 @@ ep_parse_optional_if_clause (char **arg) > { > char *cond_string; > > - if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((*arg)[2])) > + if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((int) (*arg)[2])) > return NULL; > > /* Skip the "if" keyword. */ > @@ -6227,13 +6227,13 @@ ep_parse_optional_filename (char **arg) > int i; > char c; > > - if ((*arg_p == '\0') || isspace (*arg_p)) > + if ((*arg_p == '\0') || isspace ((int) *arg_p)) > return NULL; > > for (i = 0;; i++) > { > c = *arg_p; > - if (isspace (c)) > + if (isspace ((int) c)) > c = '\0'; > filename[i] = c; > if (c == '\0') > @@ -6269,7 +6269,7 @@ catch_fork_command_1 (catch_fork_kind fo > First, check if there's an if clause. */ > cond_string = ep_parse_optional_if_clause (&arg); > > - if ((*arg != '\0') && !isspace (*arg)) > + if ((*arg != '\0') && !isspace ((int) *arg)) > error (_("Junk at end of arguments.")); > > /* If this target supports it, create a fork or vfork catchpoint > @@ -6302,7 +6302,7 @@ catch_exec_command_1 (char *arg, int tem > First, check if there's an if clause. */ > cond_string = ep_parse_optional_if_clause (&arg); > > - if ((*arg != '\0') && !isspace (*arg)) > + if ((*arg != '\0') && !isspace ((int) *arg)) > error (_("Junk at end of arguments.")); > > /* If this target supports it, create an exec catchpoint > @@ -6342,7 +6342,7 @@ catch_load_command_1 (char *arg, int tem > cond_string = ep_parse_optional_if_clause (&arg); > } > > - if ((*arg != '\0') && !isspace (*arg)) > + if ((*arg != '\0') && !isspace ((int) *arg)) > error (_("Junk at end of arguments.")); > > /* Create a load breakpoint that only triggers when a load of > @@ -6384,7 +6384,7 @@ catch_unload_command_1 (char *arg, int t > cond_string = ep_parse_optional_if_clause (&arg); > } > > - if ((*arg != '\0') && !isspace (*arg)) > + if ((*arg != '\0') && !isspace ((int) *arg)) > error (_("Junk at end of arguments.")); > > /* Create an unload breakpoint that only triggers when an unload of > @@ -6533,7 +6533,7 @@ catch_exception_command_1 (enum exceptio > > cond_string = ep_parse_optional_if_clause (&arg); > > - if ((*arg != '\0') && !isspace (*arg)) > + if ((*arg != '\0') && !isspace ((int) *arg)) > error (_("Junk at end of arguments.")); > > if ((ex_event != EX_EVENT_THROW) && > Index: coffread.c > =================================================================== > RCS file: /cvs/src/src/gdb/coffread.c,v > retrieving revision 1.66 > diff -p -u -r1.66 coffread.c > --- coffread.c 9 Jan 2007 17:58:50 -0000 1.66 > +++ coffread.c 6 Apr 2007 22:06:45 -0000 > @@ -220,7 +220,7 @@ coff_locate_sections (bfd *abfd, asectio > /* We can have multiple .stab sections if linked with > --split-by-reloc. */ > for (s = name + sizeof ".stab" - 1; *s != '\0'; s++) > - if (!isdigit (*s)) > + if (!isdigit ((int) *s)) > break; > if (*s == '\0') > { > Index: completer.c > =================================================================== > RCS file: /cvs/src/src/gdb/completer.c,v > retrieving revision 1.18 > diff -p -u -r1.18 completer.c > --- completer.c 9 Jan 2007 17:58:50 -0000 1.18 > +++ completer.c 6 Apr 2007 22:06:45 -0000 > @@ -437,7 +437,7 @@ complete_line (const char *text, char *l > /* lookup_cmd_1 advances p up to the first ambiguous thing, but > doesn't advance over that thing itself. Do so now. */ > q = p; > - while (*q && (isalnum (*q) || *q == '-' || *q == '_')) > + while (*q && (isalnum ((int) *q) || *q == '-' || *q == '_')) > ++q; > if (q != tmp_command + point) > { > @@ -543,7 +543,7 @@ complete_line (const char *text, char *l > q = p; > while (q > tmp_command) > { > - if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_') > + if (isalnum ((int) q[-1]) || q[-1] == '-' || q[-1] == '_') > --q; > else > break; > Index: cp-support.c > =================================================================== > RCS file: /cvs/src/src/gdb/cp-support.c,v > retrieving revision 1.23 > diff -p -u -r1.23 cp-support.c > --- cp-support.c 21 Jan 2007 16:55:49 -0000 1.23 > +++ cp-support.c 6 Apr 2007 22:06:45 -0000 > @@ -513,7 +513,7 @@ cp_find_first_component_aux (const char > && strncmp (name + index, "operator", LENGTH_OF_OPERATOR) == 0) > { > index += LENGTH_OF_OPERATOR; > - while (isspace(name[index])) > + while (isspace((int) name[index])) > ++index; > switch (name[index]) > { > Index: exec.c > =================================================================== > RCS file: /cvs/src/src/gdb/exec.c,v > retrieving revision 1.65 > diff -p -u -r1.65 exec.c > --- exec.c 9 Feb 2007 20:11:47 -0000 1.65 > +++ exec.c 6 Apr 2007 22:06:45 -0000 > @@ -645,7 +645,7 @@ set_section_command (char *args, int fro > error (_("Must specify section name and its virtual address")); > > /* Parse out section name */ > - for (secname = args; !isspace (*args); args++); > + for (secname = args; !isspace ((int) *args); args++); > seclen = args - secname; > > /* Parse out new virtual address */ > Index: expprint.c > =================================================================== > RCS file: /cvs/src/src/gdb/expprint.c,v > retrieving revision 1.26 > diff -p -u -r1.26 expprint.c > --- expprint.c 9 Jan 2007 17:58:50 -0000 1.26 > +++ expprint.c 6 Apr 2007 22:06:45 -0000 > @@ -809,7 +809,7 @@ dump_raw_expression (struct expression * > eltscan++) > { > fprintf_filtered (stream, "%c", > - isprint (*eltscan) ? (*eltscan & 0xFF) : '.'); > + isprint ((int) (*eltscan ? *eltscan & 0xFF : '.'))); > } > fprintf_filtered (stream, "\n"); > } > Index: gnu-v2-abi.c > =================================================================== > RCS file: /cvs/src/src/gdb/gnu-v2-abi.c,v > retrieving revision 1.24 > diff -p -u -r1.24 gnu-v2-abi.c > --- gnu-v2-abi.c 9 Jan 2007 17:58:51 -0000 1.24 > +++ gnu-v2-abi.c 6 Apr 2007 22:06:45 -0000 > @@ -53,7 +53,7 @@ static enum ctor_kinds > gnuv2_is_constructor_name (const char *name) > { > if ((name[0] == '_' && name[1] == '_' > - && (isdigit (name[2]) || strchr ("Qt", name[2]))) > + && (isdigit ((int) name[2]) || strchr ("Qt", name[2]))) > || strncmp (name, "__ct__", 6) == 0) > return complete_object_ctor; > else > Index: infcmd.c > =================================================================== > RCS file: /cvs/src/src/gdb/infcmd.c,v > retrieving revision 1.151 > diff -p -u -r1.151 infcmd.c > --- infcmd.c 27 Mar 2007 23:01:00 -0000 1.151 > +++ infcmd.c 6 Apr 2007 22:06:46 -0000 > @@ -1701,7 +1701,7 @@ registers_info (char *addr_exp, int fpre > const char *end; > > /* Keep skipping leading white space. */ > - if (isspace ((*addr_exp))) > + if (isspace ((int) *addr_exp)) > { > addr_exp++; > continue; > @@ -1711,12 +1711,12 @@ registers_info (char *addr_exp, int fpre > resembling a register following it. */ > if (addr_exp[0] == '$') > addr_exp++; > - if (isspace ((*addr_exp)) || (*addr_exp) == '\0') > + if (isspace ((int) *addr_exp) || *addr_exp == '\0') > error (_("Missing register name")); > > /* Find the start/end of this register name/num/group. */ > start = addr_exp; > - while ((*addr_exp) != '\0' && !isspace ((*addr_exp))) > + while ((*addr_exp) != '\0' && !isspace ((int) *addr_exp)) > addr_exp++; > end = addr_exp; > > Index: infrun.c > =================================================================== > RCS file: /cvs/src/src/gdb/infrun.c,v > retrieving revision 1.225 > diff -p -u -r1.225 infrun.c > --- infrun.c 29 Mar 2007 07:35:39 -0000 1.225 > +++ infrun.c 6 Apr 2007 22:06:46 -0000 > @@ -3350,7 +3350,7 @@ handle_command (char *args, int from_tty > while (*argv != NULL) > { > wordlen = strlen (*argv); > - for (digits = 0; isdigit ((*argv)[digits]); digits++) > + for (digits = 0; isdigit ((int) (*argv)[digits]); digits++) > {; > } > allsigs = 0; > Index: jv-exp.y > =================================================================== > RCS file: /cvs/src/src/gdb/jv-exp.y,v > retrieving revision 1.24 > diff -p -u -r1.24 jv-exp.y > --- jv-exp.y 9 Jan 2007 17:58:51 -0000 1.24 > +++ jv-exp.y 6 Apr 2007 22:06:46 -0000 > @@ -724,7 +724,7 @@ parse_number (p, len, parsed_float, puti > > if (c == 'f' || c == 'F') > putithere->typed_val_float.type = builtin_type_float; > - else if (isdigit (c) || c == '.' || c == 'd' || c == 'D') > + else if (isdigit ((int) c) || c == '.' || c == 'd' || c == 'D') > putithere->typed_val_float.type = builtin_type_double; > else > return ERROR; > Index: main.c > =================================================================== > RCS file: /cvs/src/src/gdb/main.c,v > retrieving revision 1.62 > diff -p -u -r1.62 main.c > --- main.c 9 Jan 2007 21:34:29 -0000 1.62 > +++ main.c 6 Apr 2007 22:06:46 -0000 > @@ -736,7 +736,7 @@ extern int gdbtk_test (char *); > If its first character is a digit, try attach first > and then corefile. Otherwise try corefile first. */ > > - if (isdigit (corearg[0])) > + if (isdigit ((int) corearg[0])) > { > if (catch_command_errors (attach_command, corearg, > !batch, RETURN_MASK_ALL) == 0) > Index: maint.c > =================================================================== > RCS file: /cvs/src/src/gdb/maint.c,v > retrieving revision 1.59 > diff -p -u -r1.59 maint.c > --- maint.c 9 Jan 2007 17:58:52 -0000 1.59 > +++ maint.c 6 Apr 2007 22:06:46 -0000 > @@ -455,14 +455,14 @@ maintenance_translate_address (char *arg > sect = NULL; > p = arg; > > - if (!isdigit (*p)) > + if (!isdigit ((int) *p)) > { /* See if we have a valid section name */ > - while (*p && !isspace (*p)) /* Find end of section name */ > + while (*p && !isspace ((int) *p)) /* Find end of section name */ > p++; > if (*p == '\000') /* End of command? */ > error (_("Need to specify <section-name> and <address>")); > *p++ = '\000'; > - while (isspace (*p)) > + while (isspace ((int) *p)) > p++; /* Skip whitespace */ > > ALL_OBJFILES (objfile) > Index: minsyms.c > =================================================================== > RCS file: /cvs/src/src/gdb/minsyms.c,v > retrieving revision 1.49 > diff -p -u -r1.49 minsyms.c > --- minsyms.c 9 Jan 2007 22:14:35 -0000 1.49 > +++ minsyms.c 6 Apr 2007 22:06:46 -0000 > @@ -83,7 +83,7 @@ msymbol_hash_iw (const char *string) > unsigned int hash = 0; > while (*string && *string != '(') > { > - while (isspace (*string)) > + while (isspace ((int) *string)) > ++string; > if (*string && *string != '(') > { > Index: objc-exp.y > =================================================================== > RCS file: /cvs/src/src/gdb/objc-exp.y,v > retrieving revision 1.23 > diff -p -u -r1.23 objc-exp.y > --- objc-exp.y 9 Jan 2007 17:58:55 -0000 1.23 > +++ objc-exp.y 6 Apr 2007 22:06:46 -0000 > @@ -1034,7 +1034,7 @@ parse_number (p, len, parsed_float, puti > putithere->typed_val_float.type = builtin_type_float; > else if (c == 'l') > putithere->typed_val_float.type = builtin_type_long_double; > - else if (isdigit (c) || c == '.') > + else if (isdigit ((int) c) || c == '.') > putithere->typed_val_float.type = builtin_type_double; > else > return ERROR; > Index: objc-lang.c > =================================================================== > RCS file: /cvs/src/src/gdb/objc-lang.c,v > retrieving revision 1.52 > diff -p -u -r1.52 objc-lang.c > --- objc-lang.c 9 Jan 2007 17:58:55 -0000 1.52 > +++ objc-lang.c 6 Apr 2007 22:06:46 -0000 > @@ -1131,23 +1131,23 @@ parse_selector (char *method, char **sel > > s1 = method; > > - while (isspace (*s1)) > + while (isspace ((int) *s1)) > s1++; > if (*s1 == '\'') > { > found_quote = 1; > s1++; > } > - while (isspace (*s1)) > + while (isspace ((int) *s1)) > s1++; > > nselector = s1; > s2 = s1; > > for (;;) { > - if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':')) > + if (isalnum ((int) *s2) || (*s2 == '_') || (*s2 == ':')) > *s1++ = *s2; > - else if (isspace (*s2)) > + else if (isspace ((int) *s2)) > ; > else if ((*s2 == '\0') || (*s2 == '\'')) > break; > @@ -1157,13 +1157,13 @@ parse_selector (char *method, char **sel > } > *s1++ = '\0'; > > - while (isspace (*s2)) > + while (isspace ((int) *s2)) > s2++; > if (found_quote) > { > if (*s2 == '\'') > s2++; > - while (isspace (*s2)) > + while (isspace ((int) *s2)) > s2++; > } > > @@ -1193,20 +1193,20 @@ parse_method (char *method, char *type, > > s1 = method; > > - while (isspace (*s1)) > + while (isspace ((int) *s1)) > s1++; > if (*s1 == '\'') > { > found_quote = 1; > s1++; > } > - while (isspace (*s1)) > + while (isspace ((int) *s1)) > s1++; > > if ((s1[0] == '+') || (s1[0] == '-')) > ntype = *s1++; > > - while (isspace (*s1)) > + while (isspace ((int) *s1)) > s1++; > > if (*s1 != '[') > @@ -1214,20 +1214,20 @@ parse_method (char *method, char *type, > s1++; > > nclass = s1; > - while (isalnum (*s1) || (*s1 == '_')) > + while (isalnum ((int) *s1) || (*s1 == '_')) > s1++; > > s2 = s1; > - while (isspace (*s2)) > + while (isspace ((int) *s2)) > s2++; > > if (*s2 == '(') > { > s2++; > - while (isspace (*s2)) > + while (isspace ((int) *s2)) > s2++; > ncategory = s2; > - while (isalnum (*s2) || (*s2 == '_')) > + while (isalnum ((int) *s2) || (*s2 == '_')) > s2++; > *s2++ = '\0'; > } > @@ -1239,9 +1239,9 @@ parse_method (char *method, char *type, > s1 = s2; > > for (;;) { > - if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':')) > + if (isalnum ((int) *s2) || (*s2 == '_') || (*s2 == ':')) > *s1++ = *s2; > - else if (isspace (*s2)) > + else if (isspace ((int) *s2)) > ; > else if (*s2 == ']') > break; > @@ -1252,14 +1252,14 @@ parse_method (char *method, char *type, > *s1++ = '\0'; > s2++; > > - while (isspace (*s2)) > + while (isspace ((int) *s2)) > s2++; > if (found_quote) > { > if (*s2 != '\'') > return NULL; > s2++; > - while (isspace (*s2)) > + while (isspace ((int) *s2)) > s2++; > } > > Index: p-exp.y > =================================================================== > RCS file: /cvs/src/src/gdb/p-exp.y,v > retrieving revision 1.34 > diff -p -u -r1.34 p-exp.y > --- p-exp.y 9 Jan 2007 17:58:55 -0000 1.34 > +++ p-exp.y 6 Apr 2007 22:06:46 -0000 > @@ -809,7 +809,7 @@ parse_number (p, len, parsed_float, puti > putithere->typed_val_float.type = builtin_type_float; > else if (c == 'l') > putithere->typed_val_float.type = builtin_type_long_double; > - else if (isdigit (c) || c == '.') > + else if (isdigit ((int) c) || c == '.') > putithere->typed_val_float.type = builtin_type_double; > else > return ERROR; > @@ -1072,8 +1072,9 @@ yylex () > if (explen > 2) > for (i = 0; i < sizeof (tokentab3) / sizeof (tokentab3[0]); i++) > if (strncasecmp (tokstart, tokentab3[i].operator, 3) == 0 > - && (!isalpha (tokentab3[i].operator[0]) || explen == 3 > - || (!isalpha (tokstart[3]) && !isdigit (tokstart[3]) && tokstart[3] != '_'))) > + && (!isalpha ((int) tokentab3[i].operator[0]) || explen == 3 > + || (!isalpha ((int) tokstart[3]) > + && !isdigit ((int) tokstart[3]) && tokstart[3] != '_'))) > { > lexptr += 3; > yylval.opcode = tokentab3[i].opcode; > @@ -1084,8 +1085,9 @@ yylex () > if (explen > 1) > for (i = 0; i < sizeof (tokentab2) / sizeof (tokentab2[0]); i++) > if (strncasecmp (tokstart, tokentab2[i].operator, 2) == 0 > - && (!isalpha (tokentab2[i].operator[0]) || explen == 2 > - || (!isalpha (tokstart[2]) && !isdigit (tokstart[2]) && tokstart[2] != '_'))) > + && (!isalpha ((int) tokentab2[i].operator[0]) || explen == 2 > + || (!isalpha ((int) tokstart[2]) > + && !isdigit ((int) tokstart[2]) && tokstart[2] != '_'))) > { > lexptr += 2; > yylval.opcode = tokentab2[i].opcode; > Index: p-typeprint.c > =================================================================== > RCS file: /cvs/src/src/gdb/p-typeprint.c,v > retrieving revision 1.18 > diff -p -u -r1.18 p-typeprint.c > --- p-typeprint.c 9 Jan 2007 17:58:55 -0000 1.18 > +++ p-typeprint.c 6 Apr 2007 22:06:46 -0000 > @@ -157,9 +157,9 @@ pascal_type_print_method_args (char *phy > char *argname; > fputs_filtered (" (", stream); > /* we must demangle this */ > - while (isdigit (physname[0])) > + while (isdigit ((int) physname[0])) > { > - while (isdigit (physname[len])) > + while (isdigit ((int) physname[len])) > { > len++; > } > Index: parse.c > =================================================================== > RCS file: /cvs/src/src/gdb/parse.c,v > retrieving revision 1.57 > diff -p -u -r1.57 parse.c > --- parse.c 27 Feb 2007 19:46:04 -0000 1.57 > +++ parse.c 6 Apr 2007 22:06:46 -0000 > @@ -641,10 +641,10 @@ parse_nested_classes_for_hpacc (char *na > /* Get to the end of the next namespace or class spec. */ > /* If we're looking at some non-token, fail immediately */ > start = p; > - if (!(isalpha (*p) || *p == '$' || *p == '_')) > + if (!(isalpha ((int) *p) || *p == '$' || *p == '_')) > return (struct symbol *) NULL; > p++; > - while (*p && (isalnum (*p) || *p == '$' || *p == '_')) > + while (*p && (isalnum ((int) *p) || *p == '$' || *p == '_')) > p++; > > if (*p == '<') > @@ -667,7 +667,7 @@ parse_nested_classes_for_hpacc (char *na > p++; > > /* Done with tokens? */ > - if (!*p || !(isalpha (*p) || *p == '$' || *p == '_')) > + if (!*p || !(isalpha ((int) *p) || *p == '$' || *p == '_')) > done = 1; > > tmp = (char *) alloca (prefix_len + end - start + 3); > Index: remote-utils.c > =================================================================== > RCS file: /cvs/src/src/gdb/remote-utils.c,v > retrieving revision 1.21 > diff -p -u -r1.21 remote-utils.c > --- remote-utils.c 9 Jan 2007 17:58:56 -0000 1.21 > +++ remote-utils.c 6 Apr 2007 22:06:47 -0000 > @@ -113,10 +113,10 @@ sr_scan_args (char *proto, char *args) > return; > > /* scan off white space. */ > - for (p = args; isspace (*p); ++p);; > + for (p = args; isspace ((int) *p); ++p);; > > /* find end of device name. */ > - for (q = p; *q != '\0' && !isspace (*q); ++q);; > + for (q = p; *q != '\0' && !isspace ((int) *q); ++q);; > > /* check for missing or empty device name. */ > CHECKDONE (p, q); > @@ -137,7 +137,7 @@ sr_scan_args (char *proto, char *args) > sr_set_debug (n); > > /* scan off remaining white space. */ > - for (p = q; isspace (*p); ++p);; > + for (p = q; isspace ((int) *p); ++p);; > > /* if not end of string, then there's unrecognized junk. */ > if (*p != '\0') > Index: remote.c > =================================================================== > RCS file: /cvs/src/src/gdb/remote.c,v > retrieving revision 1.247 > diff -p -u -r1.247 remote.c > --- remote.c 27 Mar 2007 19:11:10 -0000 1.247 > +++ remote.c 6 Apr 2007 22:06:47 -0000 > @@ -811,7 +811,7 @@ packet_check_result (const char *buf) > /* The stub recognized the packet request. Check that the > operation succeeded. */ > if (buf[0] == 'E' > - && isxdigit (buf[1]) && isxdigit (buf[2]) > + && isxdigit ((int) buf[1]) && isxdigit ((int) buf[2]) > && buf[3] == '\0') > /* "Enn" - definitly an error. */ > return PACKET_ERROR; > @@ -4342,7 +4342,7 @@ remote_read_bytes (CORE_ADDR memaddr, gd > getpkt (&rs->buf, &rs->buf_size, 0); > > if (rs->buf[0] == 'E' > - && isxdigit (rs->buf[1]) && isxdigit (rs->buf[2]) > + && isxdigit ((int) rs->buf[1]) && isxdigit ((int) rs->buf[2]) > && rs->buf[3] == '\0') > { > /* There is no correspondance between what the remote > @@ -5716,7 +5716,7 @@ remote_xfer_partial (struct target_ops * > while (annex[i] && (i < (get_remote_packet_size () - 8))) > { > /* Bad caller may have sent forbidden characters. */ > - gdb_assert (isprint (annex[i]) && annex[i] != '$' && annex[i] != '#'); > + gdb_assert (isprint ((int) annex[i]) && annex[i] != '$' && annex[i] != '#'); > *p2++ = annex[i]; > i++; > } > @@ -5779,7 +5779,7 @@ remote_rcmd (char *command, > if (strcmp (buf, "OK") == 0) > break; > if (strlen (buf) == 3 && buf[0] == 'E' > - && isdigit (buf[1]) && isdigit (buf[2])) > + && isdigit ((int) buf[1]) && isdigit ((int) buf[2])) > { > error (_("Protocol error with Rcmd")); > } > Index: serial.c > =================================================================== > RCS file: /cvs/src/src/gdb/serial.c,v > retrieving revision 1.28 > diff -p -u -r1.28 serial.c > --- serial.c 9 Jan 2007 17:58:58 -0000 1.28 > +++ serial.c 6 Apr 2007 22:06:47 -0000 > @@ -191,7 +191,7 @@ serial_open (const char *name) > ops = serial_interface_lookup ("pipe"); > /* Discard ``|'' and any space before the command itself. */ > ++open_name; > - while (isspace (*open_name)) > + while (isspace ((int) *open_name)) > ++open_name; > } > /* Check for a colon, suggesting an IP address/port pair. > Index: stabsread.c > =================================================================== > RCS file: /cvs/src/src/gdb/stabsread.c,v > retrieving revision 1.88 > diff -p -u -r1.88 stabsread.c > --- stabsread.c 29 Mar 2007 18:33:58 -0000 1.88 > +++ stabsread.c 6 Apr 2007 22:06:47 -0000 > @@ -554,7 +554,7 @@ process_reference (char **string) > p = *string + 1; > > /* Read number as reference id. */ > - while (*p && isdigit (*p)) > + while (*p && isdigit ((int) *p)) > { > refnum = refnum * 10 + *p - '0'; > p++; > @@ -707,7 +707,7 @@ define_symbol (CORE_ADDR valu, char *str > deftypes we know how to handle is a local. */ > if (!strchr ("cfFGpPrStTvVXCR", *p)) > #else > - if (isdigit (*p) || *p == '(' || *p == '-') > + if (isdigit ((int) *p) || *p == '(' || *p == '-') > #endif > deftype = 'l'; > else > @@ -1765,7 +1765,7 @@ again: > break; > > case '@': > - if (isdigit (**pp) || **pp == '(' || **pp == '-') > + if (isdigit ((int) **pp) || **pp == '(' || **pp == '-') > { /* Member (class & variable) type */ > /* FIXME -- we should be doing smash_to_XXX types here. */ > > Index: stack.c > =================================================================== > RCS file: /cvs/src/src/gdb/stack.c,v > retrieving revision 1.143 > diff -p -u -r1.143 stack.c > --- stack.c 29 Mar 2007 07:35:39 -0000 1.143 > +++ stack.c 6 Apr 2007 22:06:48 -0000 > @@ -720,14 +720,14 @@ parse_frame_specification_1 (const char > const char *p; > > /* Skip leading white space, bail of EOL. */ > - while (isspace (*frame_exp)) > + while (isspace ((int) *frame_exp)) > frame_exp++; > if (!*frame_exp) > break; > > /* Parse the argument, extract it, save it. */ > for (p = frame_exp; > - *p && !isspace (*p); > + *p && !isspace ((int) *p); > p++); > addr_string = savestring (frame_exp, p - frame_exp); > frame_exp = p; > Index: symfile.c > =================================================================== > RCS file: /cvs/src/src/gdb/symfile.c,v > retrieving revision 1.182 > diff -p -u -r1.182 symfile.c > --- symfile.c 26 Feb 2007 20:04:38 -0000 1.182 > +++ symfile.c 6 Apr 2007 22:06:48 -0000 > @@ -2414,7 +2414,7 @@ set_ext_lang_command (char *args, int fr > error (_("'%s': Filename extension must begin with '.'"), ext_args); > > /* Find end of first arg. */ > - while (*cp && !isspace (*cp)) > + while (*cp && !isspace ((int) *cp)) > cp++; > > if (*cp == '\0') > @@ -2425,7 +2425,7 @@ set_ext_lang_command (char *args, int fr > *cp++ = '\0'; > > /* Find beginning of second arg, which should be a source language. */ > - while (*cp && isspace (*cp)) > + while (*cp && isspace ((int) *cp)) > cp++; > > if (*cp == '\0') > Index: symtab.c > =================================================================== > RCS file: /cvs/src/src/gdb/symtab.c,v > retrieving revision 1.156 > diff -p -u -r1.156 symtab.c > --- symtab.c 28 Mar 2007 00:12:15 -0000 1.156 > +++ symtab.c 6 Apr 2007 22:06:49 -0000 > @@ -2568,7 +2568,7 @@ operator_chars (char *p, char **end) > > /* Don't get faked out by `operator' being part of a longer > identifier. */ > - if (isalpha (*p) || *p == '_' || *p == '$' || *p == '\0') > + if (isalpha ((int) *p) || *p == '_' || *p == '$' || *p == '\0') > return *end; > > /* Allow some whitespace between `operator' and the operator symbol. */ > @@ -2577,10 +2577,10 @@ operator_chars (char *p, char **end) > > /* Recognize 'operator TYPENAME'. */ > > - if (isalpha (*p) || *p == '_' || *p == '$') > + if (isalpha ((int) *p) || *p == '_' || *p == '$') > { > char *q = p + 1; > - while (isalnum (*q) || *q == '_' || *q == '$') > + while (isalnum ((int) *q) || *q == '_' || *q == '$') > q++; > *end = q; > return p; > @@ -2968,7 +2968,7 @@ search_symbols (char *regexp, domain_enu > if (*opname) > { > int fix = -1; /* -1 means ok; otherwise number of spaces needed. */ > - if (isalpha (*opname) || *opname == '_' || *opname == '$') > + if (isalpha ((int) *opname) || *opname == '_' || *opname == '$') > { > /* There should 1 space between 'operator' and 'TYPENAME'. */ > if (opname[-1] != ' ' || opname[-2] == ' ') > @@ -3510,7 +3510,7 @@ language_search_unquoted_string (char *t > { > for (; p > text; --p) > { > - if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0') > + if (isalnum ((int) p[-1]) || p[-1] == '_' || p[-1] == '\0') > continue; > else > { > @@ -3530,7 +3530,7 @@ language_search_unquoted_string (char *t > Unfortunately we have to find it now to decide. */ > > while (t > text) > - if (isalnum (t[-1]) || t[-1] == '_' || > + if (isalnum ((int) t[-1]) || t[-1] == '_' || > t[-1] == ' ' || t[-1] == ':' || > t[-1] == '(' || t[-1] == ')') > --t; > @@ -3617,7 +3617,7 @@ make_symbol_completion_list (char *text, > which are in symbols. */ > while (p > text) > { > - if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0') > + if (isalnum ((int) p[-1]) || p[-1] == '_' || p[-1] == '\0') > --p; > else > break; > Index: thread.c > =================================================================== > RCS file: /cvs/src/src/gdb/thread.c,v > retrieving revision 1.52 > diff -p -u -r1.52 thread.c > --- thread.c 30 Mar 2007 12:57:43 -0000 1.52 > +++ thread.c 6 Apr 2007 22:06:49 -0000 > @@ -584,7 +584,7 @@ thread_apply_command (char *tidlist, int > if (tidlist == NULL || *tidlist == '\000') > error (_("Please specify a thread ID list")); > > - for (cmd = tidlist; *cmd != '\000' && !isalpha (*cmd); cmd++); > + for (cmd = tidlist; *cmd != '\000' && !isalpha ((int) *cmd); cmd++); > > if (*cmd == '\000') > error (_("Please specify a command following the thread ID list")); > Index: utils.c > =================================================================== > RCS file: /cvs/src/src/gdb/utils.c,v > retrieving revision 1.176 > diff -p -u -r1.176 utils.c > --- utils.c 30 Mar 2007 09:31:31 -0000 1.176 > +++ utils.c 6 Apr 2007 22:06:49 -0000 > @@ -2310,11 +2310,11 @@ strcmp_iw (const char *string1, const ch > { > while ((*string1 != '\0') && (*string2 != '\0')) > { > - while (isspace (*string1)) > + while (isspace ((int) *string1)) > { > string1++; > } > - while (isspace (*string2)) > + while (isspace ((int) *string2)) > { > string2++; > } > @@ -2369,11 +2369,11 @@ strcmp_iw_ordered (const char *string1, > { > while ((*string1 != '\0') && (*string2 != '\0')) > { > - while (isspace (*string1)) > + while (isspace ((int) *string1)) > { > string1++; > } > - while (isspace (*string2)) > + while (isspace ((int) *string2)) > { > string2++; > } > @@ -2846,9 +2846,9 @@ string_to_core_addr (const char *my_stri > int i; > for (i = 2; my_string[i] != '\0'; i++) > { > - if (isdigit (my_string[i])) > + if (isdigit ((int) my_string[i])) > addr = (my_string[i] - '0') + (addr * 16); > - else if (isxdigit (my_string[i])) > + else if (isxdigit ((int) my_string[i])) > addr = (tolower (my_string[i]) - 'a' + 0xa) + (addr * 16); > else > error (_("invalid hex \"%s\""), my_string); > @@ -2860,7 +2860,7 @@ string_to_core_addr (const char *my_stri > int i; > for (i = 0; my_string[i] != '\0'; i++) > { > - if (isdigit (my_string[i])) > + if (isdigit ((int) my_string[i])) > addr = (my_string[i] - '0') + (addr * 10); > else > error (_("invalid decimal \"%s\""), my_string); > @@ -3136,7 +3136,7 @@ strtoulst (const char *num, const char * > int i = 0; > > /* Skip leading whitespace. */ > - while (isspace (num[i])) > + while (isspace ((int) num[i])) > i++; > > /* Handle prefixes. */ > Index: cli/cli-cmds.c > =================================================================== > RCS file: /cvs/src/src/gdb/cli/cli-cmds.c,v > retrieving revision 1.70 > diff -p -u -r1.70 cli-cmds.c > --- cli/cli-cmds.c 27 Feb 2007 19:46:04 -0000 1.70 > +++ cli/cli-cmds.c 6 Apr 2007 22:06:49 -0000 > @@ -499,17 +499,17 @@ source_command (char *args, int from_tty > if (args) > { > /* Make sure leading white space does not break the comparisons. */ > - while (isspace(args[0])) > + while (isspace((int) args[0])) > args++; > > /* Is -v the first thing in the string? */ > - if (args[0] == '-' && args[1] == 'v' && isspace (args[2])) > + if (args[0] == '-' && args[1] == 'v' && isspace ((int) args[2])) > { > source_verbose = 1; > > /* Trim -v and whitespace from the filename. */ > file = &args[3]; > - while (isspace (file[0])) > + while (isspace ((int) file[0])) > file++; > } > } > Index: cli/cli-decode.c > =================================================================== > RCS file: /cvs/src/src/gdb/cli/cli-decode.c,v > retrieving revision 1.60 > diff -p -u -r1.60 cli-decode.c > --- cli/cli-decode.c 9 Jan 2007 17:59:00 -0000 1.60 > +++ cli/cli-decode.c 6 Apr 2007 22:06:49 -0000 > @@ -925,7 +925,7 @@ print_doc_line (struct ui_file *stream, > } > strncpy (line_buffer, str, p - str); > line_buffer[p - str] = '\0'; > - if (islower (line_buffer[0])) > + if (islower ((int) line_buffer[0])) > line_buffer[0] = toupper (line_buffer[0]); > ui_out_text (uiout, line_buffer); > } > @@ -1027,7 +1027,7 @@ find_command_name_length (const char *te > used as a suffix for print, examine and display. > Note that this is larger than the character set allowed when creating > user-defined commands. */ > - while (isalnum (*p) || *p == '-' || *p == '_' || > + while (isalnum ((int) *p) || *p == '-' || *p == '_' || > /* Characters used by TUI specific commands. */ > *p == '+' || *p == '<' || *p == '>' || *p == '$' || > /* Characters used for XDB compatibility. */ > @@ -1118,7 +1118,7 @@ lookup_cmd_1 (char **text, struct cmd_li > for (tmp = 0; tmp < len; tmp++) > { > char x = command[tmp]; > - command[tmp] = isupper (x) ? tolower (x) : x; > + command[tmp] = isupper ((int) x) ? tolower (x) : x; > } > found = find_cmd (command, len, clist, ignore_help_classes, &nfound); > } > @@ -1474,7 +1474,7 @@ lookup_cmd_composition (char *text, > for (tmp = 0; tmp < len; tmp++) > { > char x = command[tmp]; > - command[tmp] = isupper (x) ? tolower (x) : x; > + command[tmp] = isupper ((int) x) ? tolower (x) : x; > } > *cmd = find_cmd (command, len, cur_list, 1, &nfound); > } > Index: cli/cli-dump.c > =================================================================== > RCS file: /cvs/src/src/gdb/cli/cli-dump.c,v > retrieving revision 1.26 > diff -p -u -r1.26 cli-dump.c > --- cli/cli-dump.c 8 Mar 2007 16:54:02 -0000 1.26 > +++ cli/cli-dump.c 6 Apr 2007 22:06:49 -0000 > @@ -41,7 +41,7 @@ skip_spaces (char *chp) > { > if (chp == NULL) > return NULL; > - while (isspace (*chp)) > + while (isspace ((int) *chp)) > chp++; > return chp; > } > Index: cli/cli-script.c > =================================================================== > RCS file: /cvs/src/src/gdb/cli/cli-script.c,v > retrieving revision 1.40 > diff -p -u -r1.40 cli-script.c > --- cli/cli-script.c 27 Jan 2007 12:30:46 -0000 1.40 > +++ cli/cli-script.c 6 Apr 2007 22:06:49 -0000 > @@ -683,7 +683,7 @@ locate_arg (char *p) > while ((p = strchr (p, '$'))) > { > if (strncmp (p, "$arg", 4) == 0 > - && (isdigit (p[4]) || p[4] == 'c')) > + && (isdigit ((int) p[4]) || p[4] == 'c')) > return p; > p++; > } > @@ -866,7 +866,7 @@ read_next_line (struct command_line **co > { > char *first_arg; > first_arg = p + 5; > - while (first_arg < p1 && isspace (*first_arg)) > + while (first_arg < p1 && isspace ((int) *first_arg)) > first_arg++; > *command = build_command_line (while_control, first_arg); > } > @@ -874,7 +874,7 @@ read_next_line (struct command_line **co > { > char *first_arg; > first_arg = p + 2; > - while (first_arg < p1 && isspace (*first_arg)) > + while (first_arg < p1 && isspace ((int) *first_arg)) > first_arg++; > *command = build_command_line (if_control, first_arg); > } > @@ -882,7 +882,7 @@ read_next_line (struct command_line **co > { > char *first_arg; > first_arg = p + 8; > - while (first_arg < p1 && isspace (*first_arg)) > + while (first_arg < p1 && isspace ((int) *first_arg)) > first_arg++; > *command = build_command_line (commands_control, first_arg); > } > @@ -1205,7 +1205,7 @@ validate_comname (char *comname) > p = comname; > while (*p) > { > - if (!isalnum (*p) && *p != '-' && *p != '_') > + if (!isalnum ((int) *p) && *p != '-' && *p != '_') > error (_("Junk in argument list: \"%s\""), p); > p++; > } > @@ -1294,7 +1294,7 @@ define_command (char *comname, int from_ > /* If the rest of the commands will be case insensitive, this one > should behave in the same manner. */ > for (tem = comname; *tem; tem++) > - if (isupper (*tem)) > + if (isupper ((int) *tem)) > *tem = tolower (*tem); > > sprintf (tmpbuf, "Type commands for definition of \"%s\".", comname); > Index: cli/cli-setshow.c > =================================================================== > RCS file: /cvs/src/src/gdb/cli/cli-setshow.c,v > retrieving revision 1.29 > diff -p -u -r1.29 cli-setshow.c > --- cli/cli-setshow.c 9 Jan 2007 17:59:00 -0000 1.29 > +++ cli/cli-setshow.c 6 Apr 2007 22:06:49 -0000 > @@ -40,7 +40,7 @@ parse_auto_binary_operation (const char > if (arg != NULL && *arg != '\0') > { > int length = strlen (arg); > - while (isspace (arg[length - 1]) && length > 0) > + while (isspace ((int) arg[length - 1]) && length > 0) > length--; > if (strncmp (arg, "on", length) == 0 > || strncmp (arg, "1", length) == 0 > Index: mi/mi-cmd-var.c > =================================================================== > RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v > retrieving revision 1.31 > diff -p -u -r1.31 mi-cmd-var.c > --- mi/mi-cmd-var.c 27 Feb 2007 23:42:33 -0000 1.31 > +++ mi/mi-cmd-var.c 6 Apr 2007 22:06:49 -0000 > @@ -102,7 +102,7 @@ mi_cmd_var_create (char *command, char * > xfree (name); > name = varobj_gen_name (); > } > - else if (!isalpha (*name)) > + else if (!isalpha ((int) *name)) > error (_("mi_cmd_var_create: name of object must begin with a letter")); > > if (strcmp (frame, "*") == 0) > Index: mi/mi-parse.c > =================================================================== > RCS file: /cvs/src/src/gdb/mi/mi-parse.c,v > retrieving revision 1.12 > diff -p -u -r1.12 mi-parse.c > --- mi/mi-parse.c 9 Jan 2007 17:59:08 -0000 1.12 > +++ mi/mi-parse.c 6 Apr 2007 22:06:49 -0000 > @@ -39,7 +39,7 @@ mi_parse_argv (char *args, struct mi_par > { > char *arg; > /* skip leading white space */ > - while (isspace (*chp)) > + while (isspace ((int) *chp)) > chp++; > /* Three possibilities: EOF, quoted string, or other text. */ > switch (*chp) > @@ -79,7 +79,7 @@ mi_parse_argv (char *args, struct mi_par > return; > } > /* Insist on trailing white space. */ > - if (chp[1] != '\0' && !isspace (chp[1])) > + if (chp[1] != '\0' && !isspace ((int) chp[1])) > { > freeargv (argv); > return; > @@ -110,7 +110,7 @@ mi_parse_argv (char *args, struct mi_par > characters into a buffer. */ > int len; > char *start = chp; > - while (*chp != '\0' && !isspace (*chp)) > + while (*chp != '\0' && !isspace ((int) *chp)) > { > chp++; > } > @@ -154,7 +154,7 @@ mi_parse (char *cmd) > memset (parse, 0, sizeof (*parse)); > > /* Before starting, skip leading white space. */ > - while (isspace (*cmd)) > + while (isspace ((int) *cmd)) > cmd++; > > /* Find/skip any token and then extract it. */ > @@ -167,7 +167,7 @@ mi_parse (char *cmd) > /* This wasn't a real MI command. Return it as a CLI_COMMAND. */ > if (*chp != '-') > { > - while (isspace (*chp)) > + while (isspace ((int) *chp)) > chp++; > parse->command = xstrdup (chp); > parse->op = CLI_COMMAND; > @@ -177,7 +177,7 @@ mi_parse (char *cmd) > /* Extract the command. */ > { > char *tmp = chp + 1; /* discard ``-'' */ > - for (; *chp && !isspace (*chp); chp++) > + for (; *chp && !isspace ((int) *chp); chp++) > ; > parse->command = xmalloc ((chp - tmp + 1) * sizeof (char *)); > memcpy (parse->command, tmp, chp - tmp); > @@ -198,7 +198,7 @@ mi_parse (char *cmd) > } > > /* Skip white space following the command. */ > - while (isspace (*chp)) > + while (isspace ((int) *chp)) > chp++; > > /* For new argv commands, attempt to return the parsed argument > Index: tui/tui-win.c > =================================================================== > RCS file: /cvs/src/src/gdb/tui/tui-win.c,v > retrieving revision 1.33 > diff -p -u -r1.33 tui-win.c > --- tui/tui-win.c 27 Feb 2007 19:46:04 -0000 1.33 > +++ tui/tui-win.c 6 Apr 2007 22:06:50 -0000 > @@ -1501,7 +1501,7 @@ parse_scrolling_args (char *arg, struct > > /* process the number of lines to scroll */ > buf = buf_ptr = xstrdup (arg); > - if (isdigit (*buf_ptr)) > + if (isdigit ((int) *buf_ptr)) > { > char *num_str; > > ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-06 23:06 ` Mark Kettenis @ 2007-04-06 23:17 ` Steve Ellcey 2007-04-06 23:36 ` Steve Ellcey 1 sibling, 0 replies; 22+ messages in thread From: Steve Ellcey @ 2007-04-06 23:17 UTC (permalink / raw) To: mark.kettenis; +Cc: gdb-patches > Sorry, you obviously spent some serious amount of time fixing this, > but I think this is just gross. It also would just hide the bug > mentioned above. I guess we should use -liberty's "safe-ctype.h" > instead. It didn't take that long, I kept going because I kept thinking I had found the "last one". I didn't realise how many of them there were until I finally had a build working. Using -liberty and safe-ctype.h seems reasonable but it looks like we still need to change all the files though in order to switch them from isdigit, etc. to ISDIGIT, etc. is that correct? Steve Ellcey sje@cup.hp.com ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-06 23:06 ` Mark Kettenis 2007-04-06 23:17 ` Steve Ellcey @ 2007-04-06 23:36 ` Steve Ellcey 2007-04-06 23:51 ` Mark Kettenis 1 sibling, 1 reply; 22+ messages in thread From: Steve Ellcey @ 2007-04-06 23:36 UTC (permalink / raw) To: mark.kettenis; +Cc: gdb-patches > Sorry, you obviously spent some serious amount of time fixing this, > but I think this is just gross. It also would just hide the bug > mentioned above. I guess we should use -liberty's "safe-ctype.h" > instead. Hm, this seems to lead to some new problems. safe-ctype.h defines ISALNUM, ISALPHA, ISDIGIT, etc. (uppercase) and if I start including "safe-ctype.h" instead of <ctype.h>, then I collide with readline/chardefs.h in some files (like cli/cli-dump.c) because that file includes readline/readline.h which includes readline/chardefs.h which has its own definitions of ISALNUM, ISALPHA, ISDIGIT, etc. What to do? My best guess would be to have readline/chardefs.h not define these macros if they are already defined. But now we are reaching outside the gdb subdir. Steve Ellcey sje@cup.hp.com ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-06 23:36 ` Steve Ellcey @ 2007-04-06 23:51 ` Mark Kettenis 2007-04-06 23:59 ` Steve Ellcey 2007-04-07 6:18 ` Andreas Schwab 0 siblings, 2 replies; 22+ messages in thread From: Mark Kettenis @ 2007-04-06 23:51 UTC (permalink / raw) To: sje; +Cc: gdb-patches > Date: Fri, 6 Apr 2007 16:36:06 -0700 (PDT) > From: Steve Ellcey <sje@cup.hp.com> > > > Sorry, you obviously spent some serious amount of time fixing this, > > but I think this is just gross. It also would just hide the bug > > mentioned above. I guess we should use -liberty's "safe-ctype.h" > > instead. > > Hm, this seems to lead to some new problems. safe-ctype.h defines > ISALNUM, ISALPHA, ISDIGIT, etc. (uppercase) and if I start including > "safe-ctype.h" instead of <ctype.h>, then I collide with > readline/chardefs.h in some files (like cli/cli-dump.c) because that > file includes readline/readline.h which includes readline/chardefs.h > which has its own definitions of ISALNUM, ISALPHA, ISDIGIT, etc. > > What to do? My best guess would be to have readline/chardefs.h not > define these macros if they are already defined. But now we are > reaching outside the gdb subdir. Bleach! So that's not a viable option. I think it's time to find the magic gcc option to turn the warning off. I mean char *s = "..."; isalpha(*s); is perfectly reasonable code and should not result in compiler warnings. And I really don't like adding the casts you propose. To me, a cast is an indication that something naughty is being done, and that certainly isn't the case here. Mark ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-06 23:51 ` Mark Kettenis @ 2007-04-06 23:59 ` Steve Ellcey 2007-04-07 6:18 ` Andreas Schwab 1 sibling, 0 replies; 22+ messages in thread From: Steve Ellcey @ 2007-04-06 23:59 UTC (permalink / raw) To: mark.kettenis; +Cc: gdb-patches > Bleach! So that's not a viable option. I think it's time to find the > magic gcc option to turn the warning off. I mean > > char *s = "..."; > isalpha(*s); > > is perfectly reasonable code and should not result in compiler > warnings. And I really don't like adding the casts you propose. To > me, a cast is an indication that something naughty is being done, and > that certainly isn't the case here. > > Mark That would be -Wno-char-subscripts. I'll look into adding it. Steve Ellcey sje@cup.hp.com ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-06 23:51 ` Mark Kettenis 2007-04-06 23:59 ` Steve Ellcey @ 2007-04-07 6:18 ` Andreas Schwab 2007-04-07 9:16 ` Eli Zaretskii 1 sibling, 1 reply; 22+ messages in thread From: Andreas Schwab @ 2007-04-07 6:18 UTC (permalink / raw) To: Mark Kettenis; +Cc: sje, gdb-patches Mark Kettenis <mark.kettenis@xs4all.nl> writes: > Bleach! So that's not a viable option. I think it's time to find the > magic gcc option to turn the warning off. I mean > > char *s = "..."; > isalpha(*s); > > is perfectly reasonable code and should not result in compiler > warnings. This will crash and burn if *s < 0. You really need to cast to unsigned char if you want to get defined behaviour. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-07 6:18 ` Andreas Schwab @ 2007-04-07 9:16 ` Eli Zaretskii 2007-04-07 9:26 ` Andreas Schwab 0 siblings, 1 reply; 22+ messages in thread From: Eli Zaretskii @ 2007-04-07 9:16 UTC (permalink / raw) To: Andreas Schwab; +Cc: mark.kettenis, sje, gdb-patches > From: Andreas Schwab <schwab@suse.de> > Cc: sje@cup.hp.com, gdb-patches@sourceware.org > Date: Sat, 07 Apr 2007 08:18:19 +0200 > > > char *s = "..."; > > isalpha(*s); > > > > is perfectly reasonable code and should not result in compiler > > warnings. > > This will crash and burn if *s < 0. You really need to cast to unsigned > char if you want to get defined behaviour. Isn't that the job of the isalpha implementation? ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-07 9:16 ` Eli Zaretskii @ 2007-04-07 9:26 ` Andreas Schwab 2007-04-07 17:32 ` Eli Zaretskii 0 siblings, 1 reply; 22+ messages in thread From: Andreas Schwab @ 2007-04-07 9:26 UTC (permalink / raw) To: Eli Zaretskii; +Cc: mark.kettenis, sje, gdb-patches Eli Zaretskii <eliz@gnu.org> writes: >> This will crash and burn if *s < 0. You really need to cast to unsigned >> char if you want to get defined behaviour. > > Isn't that the job of the isalpha implementation? No. It needs to be able to recognize EOF. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-07 9:26 ` Andreas Schwab @ 2007-04-07 17:32 ` Eli Zaretskii 2007-04-07 17:55 ` Andreas Schwab 0 siblings, 1 reply; 22+ messages in thread From: Eli Zaretskii @ 2007-04-07 17:32 UTC (permalink / raw) To: Andreas Schwab; +Cc: mark.kettenis, sje, gdb-patches > From: Andreas Schwab <schwab@suse.de> > Cc: mark.kettenis@xs4all.nl, sje@cup.hp.com, > gdb-patches@sourceware.org > Date: Sat, 07 Apr 2007 11:26:10 +0200 > > Eli Zaretskii <eliz@gnu.org> writes: > > >> This will crash and burn if *s < 0. You really need to cast to unsigned > >> char if you want to get defined behaviour. > > > > Isn't that the job of the isalpha implementation? > > No. It needs to be able to recognize EOF. I don't see the problem with doing both. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-07 17:32 ` Eli Zaretskii @ 2007-04-07 17:55 ` Andreas Schwab 2007-04-08 8:00 ` Eli Zaretskii 2007-04-09 12:57 ` DJ Delorie 0 siblings, 2 replies; 22+ messages in thread From: Andreas Schwab @ 2007-04-07 17:55 UTC (permalink / raw) To: Eli Zaretskii; +Cc: mark.kettenis, sje, gdb-patches Eli Zaretskii <eliz@gnu.org> writes: >> From: Andreas Schwab <schwab@suse.de> >> Cc: mark.kettenis@xs4all.nl, sje@cup.hp.com, >> gdb-patches@sourceware.org >> Date: Sat, 07 Apr 2007 11:26:10 +0200 >> >> Eli Zaretskii <eliz@gnu.org> writes: >> >> >> This will crash and burn if *s < 0. You really need to cast to unsigned >> >> char if you want to get defined behaviour. >> > >> > Isn't that the job of the isalpha implementation? >> >> No. It needs to be able to recognize EOF. > > I don't see the problem with doing both. How can it distinguish EOF from '\377'? Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-07 17:55 ` Andreas Schwab @ 2007-04-08 8:00 ` Eli Zaretskii 2007-04-08 9:32 ` Andreas Schwab 2007-04-09 12:57 ` DJ Delorie 1 sibling, 1 reply; 22+ messages in thread From: Eli Zaretskii @ 2007-04-08 8:00 UTC (permalink / raw) To: Andreas Schwab; +Cc: mark.kettenis, sje, gdb-patches > From: Andreas Schwab <schwab@suse.de> > Cc: mark.kettenis@xs4all.nl, sje@cup.hp.com, > gdb-patches@sourceware.org > Date: Sat, 07 Apr 2007 19:55:08 +0200 > > How can it distinguish EOF from '\377'? The same way you want the calling code to do that. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-08 8:00 ` Eli Zaretskii @ 2007-04-08 9:32 ` Andreas Schwab 2007-04-08 14:11 ` Daniel Jacobowitz 0 siblings, 1 reply; 22+ messages in thread From: Andreas Schwab @ 2007-04-08 9:32 UTC (permalink / raw) To: Eli Zaretskii; +Cc: mark.kettenis, sje, gdb-patches Eli Zaretskii <eliz@gnu.org> writes: >> From: Andreas Schwab <schwab@suse.de> >> Cc: mark.kettenis@xs4all.nl, sje@cup.hp.com, >> gdb-patches@sourceware.org >> Date: Sat, 07 Apr 2007 19:55:08 +0200 >> >> How can it distinguish EOF from '\377'? > > The same way you want the calling code to do that. So tell me how to distinguish two identical values? Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-08 9:32 ` Andreas Schwab @ 2007-04-08 14:11 ` Daniel Jacobowitz 2007-04-10 21:16 ` Steve Ellcey 0 siblings, 1 reply; 22+ messages in thread From: Daniel Jacobowitz @ 2007-04-08 14:11 UTC (permalink / raw) To: Andreas Schwab; +Cc: Eli Zaretskii, mark.kettenis, sje, gdb-patches On Sun, Apr 08, 2007 at 11:32:34AM +0200, Andreas Schwab wrote: > Eli Zaretskii <eliz@gnu.org> writes: > > >> From: Andreas Schwab <schwab@suse.de> > >> Cc: mark.kettenis@xs4all.nl, sje@cup.hp.com, > >> gdb-patches@sourceware.org > >> Date: Sat, 07 Apr 2007 19:55:08 +0200 > >> > >> How can it distinguish EOF from '\377'? > > > > The same way you want the calling code to do that. > > So tell me how to distinguish two identical values? I don't think we're getting anywhere... The only thing I can see is that if the caller knows it is not EOF, it should cast to unsigned char. Otherwise if there are signed characters on a platform I don't see any way the library can do the right thing; the cast to int will leave '\377' == EOF. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-08 14:11 ` Daniel Jacobowitz @ 2007-04-10 21:16 ` Steve Ellcey 2007-04-10 21:21 ` Daniel Jacobowitz 2007-04-11 3:36 ` Eli Zaretskii 0 siblings, 2 replies; 22+ messages in thread From: Steve Ellcey @ 2007-04-10 21:16 UTC (permalink / raw) To: drow, schwab, eliz, mark.kettenis, gdb-patches Well, this discussion was very interesting but I am not sure it led anywhere. If casting to '(int)' is unacceptable, double casting to '(int) (unsigned char)' is probably even less acceptable so I would like to check in the following patch that turns off the warnings so I can build on HPPA HP-UX. Tested by building on HPPA HP-UX. OK to checkin? 2007-04-10 Steve Ellcey <sje@cup.hp.com> * configure.ac (build_warnings): Add -Wno-char-subscripts. * doc/gdbint.texinfo (warning flags): Add -Wno-char-subscripts. Index: configure.ac =================================================================== RCS file: /cvs/src/src/gdb/configure.ac,v retrieving revision 1.43 diff -u -p -r1.43 configure.ac --- configure.ac 29 Mar 2007 15:24:28 -0000 1.43 +++ configure.ac 10 Apr 2007 21:08:01 -0000 @@ -1169,7 +1169,7 @@ fi # gdb/doc/gdbint.texinfo. build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \ -Wformat-nonliteral -Wno-pointer-sign \ --Wno-unused -Wno-switch" +-Wno-unused -Wno-switch -Wno-char-subscripts" AC_ARG_ENABLE(build-warnings, [ --enable-build-warnings Enable build-time compiler warnings if gcc is used], Index: doc/gdbint.texinfo =================================================================== RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v retrieving revision 1.258 diff -u -p -r1.258 gdbint.texinfo --- doc/gdbint.texinfo 10 Apr 2007 11:58:15 -0000 1.258 +++ doc/gdbint.texinfo 10 Apr 2007 21:08:03 -0000 @@ -5638,6 +5638,7 @@ is being used. @item -Wno-unused @itemx -Wno-switch +@itemx -Wno-char-subscripts These are warnings which might be useful for @value{GDBN}, but are currently too noisy to enable with @samp{-Werror}. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-10 21:16 ` Steve Ellcey @ 2007-04-10 21:21 ` Daniel Jacobowitz 2007-04-10 21:52 ` DJ Delorie 2007-04-11 3:36 ` Eli Zaretskii 1 sibling, 1 reply; 22+ messages in thread From: Daniel Jacobowitz @ 2007-04-10 21:21 UTC (permalink / raw) To: Steve Ellcey; +Cc: schwab, eliz, mark.kettenis, gdb-patches On Tue, Apr 10, 2007 at 02:16:16PM -0700, Steve Ellcey wrote: > Well, this discussion was very interesting but I am not sure it led > anywhere. If casting to '(int)' is unacceptable, double casting to > '(int) (unsigned char)' is probably even less acceptable so I would like > to check in the following patch that turns off the warnings so I can > build on HPPA HP-UX. > > Tested by building on HPPA HP-UX. > > OK to checkin? I think we should decide whether this constitutes a Real Problem, and whether we care about it, before we do this. It seems that passing a char to isfoo is not portable, although I could not tell for sure from the discussion whether ISO C requires it to work. -- Daniel Jacobowitz CodeSourcery ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-10 21:21 ` Daniel Jacobowitz @ 2007-04-10 21:52 ` DJ Delorie 0 siblings, 0 replies; 22+ messages in thread From: DJ Delorie @ 2007-04-10 21:52 UTC (permalink / raw) To: Daniel Jacobowitz; +Cc: gdb-patches Daniel Jacobowitz <drow@false.org> writes: > I think we should decide whether this constitutes a Real Problem, > and whether we care about it, before we do this. It seems that > passing a char to isfoo is not portable, although I could not tell for > sure from the discussion whether ISO C requires it to work. ISO C requires you to pass 0..255 or EOF, nothing else, to is*(). If the char might be signed, one must either cast it to unsigned char or mask it with 0xff before using it as a subscript, else one risks a negative subscript. Negative values aren't guaranteed to work with is*(), although some implementations put a second copy of the ctype data array in front of the normal one to accomodate values in the range -128..-1. I suspect this is mostly to keep uninformed programmers from bothering the mailing lists with complaints about is*() not working when really it's the programmer's fault. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-10 21:16 ` Steve Ellcey 2007-04-10 21:21 ` Daniel Jacobowitz @ 2007-04-11 3:36 ` Eli Zaretskii 1 sibling, 0 replies; 22+ messages in thread From: Eli Zaretskii @ 2007-04-11 3:36 UTC (permalink / raw) To: Steve Ellcey; +Cc: drow, schwab, mark.kettenis, gdb-patches > Date: Tue, 10 Apr 2007 14:16:16 -0700 (PDT) > From: Steve Ellcey <sje@cup.hp.com> > > Well, this discussion was very interesting but I am not sure it led > anywhere. If casting to '(int)' is unacceptable, double casting to > '(int) (unsigned char)' is probably even less acceptable so I would like > to check in the following patch that turns off the warnings so I can > build on HPPA HP-UX. > > Tested by building on HPPA HP-UX. > > OK to checkin? Fine with me, thanks. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-07 17:55 ` Andreas Schwab 2007-04-08 8:00 ` Eli Zaretskii @ 2007-04-09 12:57 ` DJ Delorie 2007-04-09 13:20 ` Andreas Schwab 1 sibling, 1 reply; 22+ messages in thread From: DJ Delorie @ 2007-04-09 12:57 UTC (permalink / raw) To: Andreas Schwab; +Cc: gdb-patches Andreas Schwab <schwab@suse.de> writes: > How can it distinguish EOF from '\377'? EOF is -1 and '\377' is 255; they're different values. Functions that may return EOF return an int, not a char, and you should not cast that value to char before checking for EOF. The is*() macros take an int because there are 257 different values (-1..255) that they must accept, not 256. In many cases, programmers use 'char' to hold the result of, for example, fgetc(), and the warning from gcc is valid (although indirect) because they've lost the EOF marker. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-09 12:57 ` DJ Delorie @ 2007-04-09 13:20 ` Andreas Schwab 2007-04-09 13:43 ` DJ Delorie 0 siblings, 1 reply; 22+ messages in thread From: Andreas Schwab @ 2007-04-09 13:20 UTC (permalink / raw) To: DJ Delorie; +Cc: gdb-patches DJ Delorie <dj@redhat.com> writes: > Andreas Schwab <schwab@suse.de> writes: >> How can it distinguish EOF from '\377'? > > EOF is -1 and '\377' is 255; The value of '\377' is implementation-defined. It is -1 when char is a signed 8-bit type. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-09 13:20 ` Andreas Schwab @ 2007-04-09 13:43 ` DJ Delorie 2007-04-09 14:17 ` Andreas Schwab 0 siblings, 1 reply; 22+ messages in thread From: DJ Delorie @ 2007-04-09 13:43 UTC (permalink / raw) To: schwab; +Cc: gdb-patches > The value of '\377' is implementation-defined. Not in the context of fgetc or <ctype.h> (the places where ambiguity exists), it isn't (emphasis mine): "If the end-of-file indicator for the input stream pointed to by stream is not set and a next character is present, the fgetc function obtains that character as an UNSIGNED CHAR converted to an int and advances the associated file position indicator for the stream (if defined)." "The header <ctype.h> declares several functions useful for classifying and mapping characters. In all cases the argument is an int, the value of which shall be representable as an UNSIGNED CHAR or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined. It is, unfortunately, up to the programmer to deal with other sources of character data which may be sign extended, and provide the ctype macros with the input range they're expecting. In the case of casts from char* strings, the programmer should: isalpha((int)(unsigned char)(*s)) Messy, but pedantic. The cast to int may be optional. ^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: Patch for isdigit/isalpha/etc. macro arguments 2007-04-09 13:43 ` DJ Delorie @ 2007-04-09 14:17 ` Andreas Schwab 0 siblings, 0 replies; 22+ messages in thread From: Andreas Schwab @ 2007-04-09 14:17 UTC (permalink / raw) To: DJ Delorie; +Cc: gdb-patches DJ Delorie <dj@redhat.com> writes: >> The value of '\377' is implementation-defined. > > Not in the context of fgetc or <ctype.h> (the places where ambiguity The context does not matter. The value of an expression is independent of its context. > In the case of casts from char* strings, the programmer should: > > isalpha((int)(unsigned char)(*s)) That's my very point. > The cast to int may be optional. It is. Andreas. -- Andreas Schwab, SuSE Labs, schwab@suse.de SuSE Linux Products GmbH, MaxfeldstraÃe 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." ^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2007-04-11 3:36 UTC | newest] Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2007-04-06 22:34 Patch for isdigit/isalpha/etc. macro arguments Steve Ellcey 2007-04-06 23:06 ` Mark Kettenis 2007-04-06 23:17 ` Steve Ellcey 2007-04-06 23:36 ` Steve Ellcey 2007-04-06 23:51 ` Mark Kettenis 2007-04-06 23:59 ` Steve Ellcey 2007-04-07 6:18 ` Andreas Schwab 2007-04-07 9:16 ` Eli Zaretskii 2007-04-07 9:26 ` Andreas Schwab 2007-04-07 17:32 ` Eli Zaretskii 2007-04-07 17:55 ` Andreas Schwab 2007-04-08 8:00 ` Eli Zaretskii 2007-04-08 9:32 ` Andreas Schwab 2007-04-08 14:11 ` Daniel Jacobowitz 2007-04-10 21:16 ` Steve Ellcey 2007-04-10 21:21 ` Daniel Jacobowitz 2007-04-10 21:52 ` DJ Delorie 2007-04-11 3:36 ` Eli Zaretskii 2007-04-09 12:57 ` DJ Delorie 2007-04-09 13:20 ` Andreas Schwab 2007-04-09 13:43 ` DJ Delorie 2007-04-09 14:17 ` Andreas Schwab
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox