Use gnulib c-ctype module in gdb

PR ada/33217 points out that gdb incorrectly calls the <ctype.h>
functions.  In particular, gdb feels free to pass a 'char' like:

    char *str = ...;
    ... isdigit (*str)

This is incorrect as isdigit only accepts EOF and values that can be
represented as 'unsigned char' -- that is, a cast is needed here to
avoid undefined behavior when 'char' is signed and a character in the
string might be sign-extended.  (As an aside, I think this API seems
obviously bad, but unfortunately this is what the standard says, and
some systems check this.)

Rather than adding casts everywhere, this changes all the code in gdb
that uses any <ctype.h> API to instead call the corresponding c-ctype
function.

Now, c-ctype has some limitations compared to <ctype.h>.  It works as
if the C locale is in effect, so in theory some non-ASCII characters
may be misclassified.  This would only affect a subset of character
sets, though, and in most places I think ASCII is sufficient -- for
example the many places in gdb that check for whitespace.
Furthermore, in practice most users are using UTF-8-based locales,
where these functions aren't really informative for non-ASCII
characters anyway; see the existing workarounds in gdb/c-support.h.

Note that safe-ctype.h cannot be used because it causes conflicts with
readline.h.  And, we canot poison the <ctype.h> identifiers as this
provokes errors from some libstdc++ headers.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33217
Approved-By: Simon Marchi <simon.marchi@efficios.com>
This commit is contained in:
Tom Tromey
2025-08-04 10:39:02 -06:00
parent 15e11aac9c
commit 3719472095
112 changed files with 312 additions and 401 deletions

View File

@@ -47,7 +47,6 @@
#include "parser-defs.h"
#include "user-regs.h"
#include "xml-syscall.h"
#include <ctype.h>
#include "record-full.h"
#include "linux-record.h"
@@ -1749,9 +1748,9 @@ aarch64_linux_core_read_description (struct gdbarch *gdbarch,
static int
aarch64_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '#' || isdigit (*s) /* Literal number. */
return (*s == '#' || c_isdigit (*s) /* Literal number. */
|| *s == '[' /* Register indirection. */
|| isalpha (*s)); /* Register value. */
|| c_isalpha (*s)); /* Register value. */
}
/* This routine is used to parse a special token in AArch64's assembly.
@@ -1782,7 +1781,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
start = tmp;
/* Register name. */
while (isalnum (*tmp))
while (c_isalnum (*tmp))
++tmp;
if (*tmp != ',')
@@ -1810,7 +1809,7 @@ aarch64_stap_parse_special_token (struct gdbarch *gdbarch,
else if (*tmp == '+')
++tmp;
if (!isdigit (*tmp))
if (!c_isdigit (*tmp))
return {};
displacement = strtol (tmp, &endp, 10);

View File

@@ -35,7 +35,6 @@
%{
#include <ctype.h>
#include "gdbsupport/unordered_map.h"
#include "expression.h"
#include "value.h"
@@ -1380,7 +1379,7 @@ write_object_renaming (struct parser_state *par_state,
[[fallthrough]];
case 'S':
renaming_expr += 1;
if (isdigit (*renaming_expr))
if (c_isdigit (*renaming_expr))
{
char *next;
long val = strtol (renaming_expr, &next, 10);
@@ -1888,7 +1887,7 @@ ada_parse_state::find_completion_bounds ()
const char *end = pstate->lexptr;
/* First the end of the prefix. Here we stop at the token start or
at '.' or space. */
for (; end > m_original_expr && end[-1] != '.' && !isspace (end[-1]); --end)
for (; end > m_original_expr && end[-1] != '.' && !c_isspace (end[-1]); --end)
{
/* Nothing. */
}

View File

@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "event-top.h"
#include "exceptions.h"
#include "extract-store-integer.h"
@@ -875,7 +874,7 @@ is_compiler_suffix (const char *str)
{
gdb_assert (*str == '[');
++str;
while (*str != '\0' && isalpha (*str))
while (*str != '\0' && c_isalpha (*str))
++str;
/* We accept a missing "]" in order to support completion. */
return *str == '\0' || (str[0] == ']' && str[1] == '\0');
@@ -1167,7 +1166,7 @@ ada_encode (const char *decoded, bool fold)
static int
is_lower_alphanum (const char c)
{
return (isdigit (c) || (isalpha (c) && islower (c)));
return (c_isdigit (c) || (c_isalpha (c) && c_islower (c)));
}
/* ENCODED is the linkage name of a symbol and LEN contains its length.
@@ -1185,11 +1184,11 @@ is_lower_alphanum (const char c)
static void
ada_remove_trailing_digits (const char *encoded, int *len)
{
if (*len > 1 && isdigit (encoded[*len - 1]))
if (*len > 1 && c_isdigit (encoded[*len - 1]))
{
int i = *len - 2;
while (i > 0 && isdigit (encoded[i]))
while (i > 0 && c_isdigit (encoded[i]))
i--;
if (i >= 0 && encoded[i] == '.')
*len = i;
@@ -1220,7 +1219,7 @@ ada_remove_po_subprogram_suffix (const char *encoded, int *len)
if (*len > 1
&& encoded[*len - 1] == 'N'
&& (isdigit (encoded[*len - 2]) || islower (encoded[*len - 2])))
&& (c_isdigit (encoded[*len - 2]) || c_islower (encoded[*len - 2])))
*len = *len - 1;
}
@@ -1232,7 +1231,7 @@ static int
remove_compiler_suffix (const char *encoded, int *len)
{
int offset = *len - 1;
while (offset > 0 && isalpha (encoded[offset]))
while (offset > 0 && c_isalpha (encoded[offset]))
--offset;
if (offset > 0 && encoded[offset] == '.')
{
@@ -1252,7 +1251,7 @@ convert_hex (const char *str, int n, uint32_t *out)
for (int i = 0; i < n; ++i)
{
if (!isxdigit (str[i]))
if (!c_isxdigit (str[i]))
return false;
result <<= 4;
result |= fromhex (str[i]);
@@ -1384,11 +1383,11 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
/* Remove trailing __{digit}+ or trailing ${digit}+. */
if (len0 > 1 && isdigit (encoded[len0 - 1]))
if (len0 > 1 && c_isdigit (encoded[len0 - 1]))
{
i = len0 - 2;
while ((i >= 0 && isdigit (encoded[i]))
|| (i >= 1 && encoded[i] == '_' && isdigit (encoded[i - 1])))
while ((i >= 0 && c_isdigit (encoded[i]))
|| (i >= 1 && encoded[i] == '_' && c_isdigit (encoded[i - 1])))
i -= 1;
if (i > 1 && encoded[i] == '_' && encoded[i - 1] == '_')
len0 = i - 1;
@@ -1399,7 +1398,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
/* The first few characters that are not alphabetic are not part
of any encoding we use, so we can copy them over verbatim. */
for (i = 0; i < len0 && !isalpha (encoded[i]); i += 1)
for (i = 0; i < len0 && !c_isalpha (encoded[i]); i += 1)
decoded.push_back (encoded[i]);
at_start_name = 1;
@@ -1415,7 +1414,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
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]))
&& !c_isalnum (encoded[i + op_len]))
{
decoded.append (ada_opname_table[k].decoded);
at_start_name = 0;
@@ -1440,11 +1439,11 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
if (len0 - i > 5 && encoded [i] == '_' && encoded [i+1] == '_'
&& encoded [i+2] == 'B' && encoded [i+3] == '_'
&& isdigit (encoded [i+4]))
&& c_isdigit (encoded [i+4]))
{
int k = i + 5;
while (k < len0 && isdigit (encoded[k]))
while (k < len0 && c_isdigit (encoded[k]))
k++; /* Skip any extra digit. */
/* Double-check that the "__B_{DIGITS}+" sequence we found
@@ -1467,11 +1466,11 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
internally generated. */
if (len0 - i > 3 && encoded [i] == '_' && encoded[i+1] == 'E'
&& isdigit (encoded[i+2]))
&& c_isdigit (encoded[i+2]))
{
int k = i + 3;
while (k < len0 && isdigit (encoded[k]))
while (k < len0 && c_isdigit (encoded[k]))
k++;
if (k < len0
@@ -1505,7 +1504,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
i++;
}
if (wide && i < len0 + 3 && encoded[i] == 'U' && isxdigit (encoded[i + 1]))
if (wide && i < len0 + 3 && encoded[i] == 'U' && c_isxdigit (encoded[i + 1]))
{
if (convert_from_hex_encoded (decoded, &encoded[i + 1], 2))
{
@@ -1513,7 +1512,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
continue;
}
}
else if (wide && i < len0 + 5 && encoded[i] == 'W' && isxdigit (encoded[i + 1]))
else if (wide && i < len0 + 5 && encoded[i] == 'W' && c_isxdigit (encoded[i + 1]))
{
if (convert_from_hex_encoded (decoded, &encoded[i + 1], 4))
{
@@ -1522,7 +1521,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
}
}
else if (wide && i < len0 + 10 && encoded[i] == 'W' && encoded[i + 1] == 'W'
&& isxdigit (encoded[i + 2]))
&& c_isxdigit (encoded[i + 2]))
{
if (convert_from_hex_encoded (decoded, &encoded[i + 2], 8))
{
@@ -1531,7 +1530,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
}
}
if (encoded[i] == 'X' && i != 0 && isalnum (encoded[i - 1]))
if (encoded[i] == 'X' && i != 0 && c_isalnum (encoded[i - 1]))
{
/* This is a X[bn]* sequence not separated from the previous
part of the name with a non-alpha-numeric character (in other
@@ -1568,7 +1567,7 @@ ada_decode (const char *encoded, bool wrap, bool operators, bool wide)
if (operators)
{
for (i = 0; i < decoded.length(); ++i)
if (isupper (decoded[i]) || decoded[i] == ' ')
if (c_isupper (decoded[i]) || decoded[i] == ' ')
goto Suppress;
}
@@ -5729,10 +5728,10 @@ is_name_suffix (const char *str)
/* Skip optional leading __[0-9]+. */
if (len > 3 && str[0] == '_' && str[1] == '_' && isdigit (str[2]))
if (len > 3 && str[0] == '_' && str[1] == '_' && c_isdigit (str[2]))
{
str += 3;
while (isdigit (str[0]))
while (c_isdigit (str[0]))
str += 1;
}
@@ -5741,7 +5740,7 @@ is_name_suffix (const char *str)
if (str[0] == '.' || str[0] == '$')
{
matching = str + 1;
while (isdigit (matching[0]))
while (c_isdigit (matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -5752,7 +5751,7 @@ is_name_suffix (const char *str)
if (len > 3 && str[0] == '_' && str[1] == '_' && str[2] == '_')
{
matching = str + 3;
while (isdigit (matching[0]))
while (c_isdigit (matching[0]))
matching += 1;
if (matching[0] == '\0')
return 1;
@@ -5781,10 +5780,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' && c_isdigit (str[2]))
{
matching = str + 3;
while (isdigit (matching[0]))
while (c_isdigit (matching[0]))
matching += 1;
if ((matching[0] == 'b' || matching[0] == 's')
&& matching [1] == '\0')
@@ -5834,17 +5833,17 @@ is_name_suffix (const char *str)
return 1;
return 0;
}
if (!isdigit (str[2]))
if (!c_isdigit (str[2]))
return 0;
for (k = 3; str[k] != '\0'; k += 1)
if (!isdigit (str[k]) && str[k] != '_')
if (!c_isdigit (str[k]) && str[k] != '_')
return 0;
return 1;
}
if (str[0] == '$' && isdigit (str[1]))
if (str[0] == '$' && c_isdigit (str[1]))
{
for (k = 2; str[k] != '\0'; k += 1)
if (!isdigit (str[k]) && str[k] != '_')
if (!c_isdigit (str[k]) && str[k] != '_')
return 0;
return 1;
}
@@ -5867,7 +5866,7 @@ is_valid_name_for_wild_match (const char *name0)
return 0;
for (i=0; decoded_name[i] != '\0'; i++)
if (isalpha (decoded_name[i]) && !islower (decoded_name[i]))
if (c_isalpha (decoded_name[i]) && !c_islower (decoded_name[i]))
return 0;
return 1;
@@ -6091,7 +6090,7 @@ ada_lookup_name_info::matches
angle bracket notation. */
const char *tmp;
for (tmp = sym_name; *tmp != '\0' && !isupper (*tmp); tmp++);
for (tmp = sym_name; *tmp != '\0' && !c_isupper (*tmp); tmp++);
if (*tmp != '\0')
match = false;
}
@@ -6206,7 +6205,7 @@ ada_is_ignored_field (struct type *type, int field_num)
{
/* Wrapper field. */
}
else if (isupper (name[0]))
else if (c_isupper (name[0]))
return 1;
}
@@ -6717,14 +6716,14 @@ ada_scan_number (const char str[], int k, LONGEST * R, int *new_k)
{
ULONGEST RU;
if (!isdigit (str[k]))
if (!c_isdigit (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 (c_isdigit (str[k]))
{
RU = RU * 10 + (str[k] - '0');
k += 1;
@@ -7380,10 +7379,10 @@ field_alignment (struct type *type, int f)
len = strlen (name);
if (!isdigit (name[len - 1]))
if (!c_isdigit (name[len - 1]))
return 1;
if (isdigit (name[len - 2]))
if (c_isdigit (name[len - 2]))
align_offset = len - 2;
else
align_offset = len - 1;
@@ -8964,7 +8963,7 @@ ada_unqualify_enum_name (const char *name)
{
while ((tmp = strstr (name, "__")) != NULL)
{
if (isdigit (tmp[2]))
if (c_isdigit (tmp[2]))
break;
else
name = tmp + 2;
@@ -9007,7 +9006,7 @@ ada_enum_name (const char *name)
else
return name;
if (isascii (v) && isprint (v))
if (c_isascii (v) && c_isprint (v))
storage = string_printf ("'%c'", v);
else if (name[1] == 'U')
storage = string_printf ("'[\"%02x\"]'", v);
@@ -12556,7 +12555,7 @@ catch_ada_exception_command_split (const char *args,
args = skip_spaces (args);
if (startswith (args, "if")
&& (isspace (args[2]) || args[2] == '\0'))
&& (c_isspace (args[2]) || args[2] == '\0'))
{
args += 2;
args = skip_spaces (args);
@@ -12833,7 +12832,7 @@ catch_ada_assert_command_split (const char *args, std::string &cond_string)
/* Check whether a condition was provided. */
if (startswith (args, "if")
&& (isspace (args[2]) || args[2] == '\0'))
&& (c_isspace (args[2]) || args[2] == '\0'))
{
args += 2;
args = skip_spaces (args);
@@ -13237,7 +13236,7 @@ do_full_match (const char *symbol_search_name,
&& symbol_search_name[1] == '_')
{
symbol_search_name += 2;
while (isdigit (*symbol_search_name))
while (c_isdigit (*symbol_search_name))
++symbol_search_name;
if (symbol_search_name[0] == '_'
&& symbol_search_name[1] == '_')

View File

@@ -335,7 +335,6 @@ false { return FALSEKEYWORD; }
. { error (_("Invalid character '%s' in expression."), yytext); }
%%
#include <ctype.h>
/* Initialize the lexer for processing new expression. */
static void
@@ -355,7 +354,7 @@ canonicalizeNumeral (char *s1, const char *s2)
{
if (*s2 != '_')
{
*s1 = tolower(*s2);
*s1 = c_tolower(*s2);
s1 += 1;
}
}
@@ -411,7 +410,7 @@ processInt (struct parser_state *par_state, const char *base0,
exp = strtol(exp0, (char **) NULL, 10);
gdb_mpz result;
while (isxdigit (*num0))
while (c_isxdigit (*num0))
{
int dig = fromhex (*num0);
if (dig >= base)
@@ -527,7 +526,7 @@ processId (const char *name0, int len)
struct stoken result;
result.ptr = name;
while (len > 0 && isspace (name0[len-1]))
while (len > 0 && c_isspace (name0[len-1]))
len -= 1;
if (name0[0] == '<' || strstr (name0, "___") != NULL)
@@ -549,12 +548,12 @@ processId (const char *name0, int len)
}
else if (in_quotes)
name[i++] = name0[i0++];
else if (isalnum (name0[i0]))
else if (c_isalnum (name0[i0]))
{
name[i] = tolower (name0[i0]);
name[i] = c_tolower (name0[i0]);
i += 1; i0 += 1;
}
else if (isspace (name0[i0]))
else if (c_isspace (name0[i0]))
i0 += 1;
else if (name0[i0] == '\'')
{
@@ -634,10 +633,10 @@ find_dot_all (const char *str)
do
i += 1;
while (isspace (str[i]));
while (c_isspace (str[i]));
if (strncasecmp (str + i, "all", 3) == 0
&& !isalnum (str[i + 3]) && str[i + 3] != '_')
&& !c_isalnum (str[i + 3]) && str[i + 3] != '_')
return i0;
}
return -1;
@@ -653,7 +652,7 @@ subseqMatch (const char *subseq, const char *str)
return 1;
else if (str[0] == '\0')
return 0;
else if (tolower (subseq[0]) == tolower (str[0]))
else if (c_tolower (subseq[0]) == c_tolower (str[0]))
return subseqMatch (subseq+1, str+1) || subseqMatch (subseq, str+1);
else
return subseqMatch (subseq, str+1);
@@ -690,7 +689,7 @@ processAttribute (const char *str)
{
gdb_assert (*str == '\'');
++str;
while (isspace (*str))
while (c_isspace (*str))
++str;
int len = strlen (str);
@@ -749,7 +748,7 @@ static void
rewind_to_char (int ch)
{
pstate->lexptr -= yyleng;
while (toupper (*pstate->lexptr) != toupper (ch))
while (c_toupper (*pstate->lexptr) != c_toupper (ch))
pstate->lexptr -= 1;
yyrestart (NULL);
}

View File

@@ -23,7 +23,6 @@
#include "cli/cli-style.h"
#include "typeprint.h"
#include "ada-lang.h"
#include <ctype.h>
static int print_selected_record_field_types (struct type *, struct type *,
int, int,
@@ -70,7 +69,7 @@ decoded_type_name (struct type *type)
if (s == name_buffer)
return name_buffer;
if (!islower (s[1]))
if (!c_islower (s[1]))
return NULL;
for (s = q = name_buffer; *s != '\0'; q += 1)

View File

@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "event-top.h"
#include "extract-store-integer.h"
#include "gdbtypes.h"
@@ -265,10 +264,10 @@ ada_emit_char (int c, struct type *type, struct ui_file *stream,
/* If this character fits in the normal ASCII range, and is
a printable character, then print the character as if it was
an ASCII character, even if this is a wide character.
The UCHAR_MAX check is necessary because the isascii function
The UCHAR_MAX check is necessary because the c_isascii function
requires that its argument have a value of an unsigned char,
or EOF (EOF is obviously not printable). */
if (c <= UCHAR_MAX && isascii (c) && isprint (c))
if (c <= UCHAR_MAX && c_isascii (c) && c_isprint (c))
{
if (c == quoter && c == '"')
gdb_printf (stream, "\"\"");

View File

@@ -56,7 +56,6 @@
#include "stap-probe.h"
#include "parser-defs.h"
#include "user-regs.h"
#include <ctype.h>
#include "elf/common.h"
/* Under ARM GNU/Linux the traditional way of performing a breakpoint
@@ -1167,10 +1166,10 @@ arm_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
static int
arm_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '#' || *s == '$' || isdigit (*s) /* Literal number. */
return (*s == '#' || *s == '$' || c_isdigit (*s) /* Literal number. */
|| *s == '[' /* Register indirection or
displacement. */
|| isalpha (*s)); /* Register value. */
|| c_isalpha (*s)); /* Register value. */
}
/* This routine is used to parse a special token in ARM's assembly.
@@ -1202,7 +1201,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
start = tmp;
/* Register name. */
while (isalnum (*tmp))
while (c_isalnum (*tmp))
++tmp;
if (*tmp != ',')
@@ -1212,7 +1211,7 @@ arm_stap_parse_special_token (struct gdbarch *gdbarch,
regname = (char *) alloca (len + 2);
offset = 0;
if (isdigit (*start))
if (c_isdigit (*start))
{
/* If we are dealing with a register whose name begins with a
digit, it means we should prefix the name with the letter

View File

@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "extract-store-integer.h"
#include "frame.h"

View File

@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "auto-load.h"
#include "gdbsupport/gdb_vecs.h"
#include "progspace.h"
@@ -1045,7 +1044,7 @@ execute_script_contents (struct auto_load_pspace_info *pspace_info,
buf = name_holder.c_str ();
for (p = buf; *p != '\0'; ++p)
{
if (isspace (*p))
if (c_isspace (*p))
break;
}
/* We don't allow nameless scripts, they're not helpful to the user. */

View File

@@ -164,7 +164,7 @@ ep_parse_optional_if_clause (const char **arg)
{
const char *cond_string;
if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !isspace ((*arg)[2]))
if (((*arg)[0] != 'i') || ((*arg)[1] != 'f') || !c_isspace ((*arg)[2]))
return NULL;
/* Skip the "if" keyword. */
@@ -204,7 +204,7 @@ catch_exec_command_1 (const char *arg, int from_tty,
First, check if there's an if clause. */
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
if ((*arg != '\0') && !c_isspace (*arg))
error (_("Junk at end of arguments."));
std::unique_ptr<exec_catchpoint> c

View File

@@ -221,7 +221,7 @@ catch_fork_command_1 (const char *arg, int from_tty,
First, check if there's an if clause. */
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
if ((*arg != '\0') && !c_isspace (*arg))
error (_("Junk at end of arguments."));
/* If this target supports it, create a fork or vfork catchpoint

View File

@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "breakpoint.h"
#include "inferior.h"
#include "cli/cli-utils.h"
@@ -369,7 +368,7 @@ catch_syscall_split_args (const char *arg)
/* Skip whitespace. */
arg = skip_spaces (arg);
for (i = 0; i < 127 && arg[i] && !isspace (arg[i]); ++i)
for (i = 0; i < 127 && arg[i] && !c_isspace (arg[i]); ++i)
cur_name[i] = arg[i];
cur_name[i] = '\0';
arg += i;

View File

@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
#include <ctype.h>
#include "breakpoint.h"
#include "exceptions.h"
#include "inferior.h"
@@ -420,7 +419,7 @@ catch_exception_event (enum exception_event_kind ex_event,
cond_string = ep_parse_optional_if_clause (&arg);
if ((*arg != '\0') && !isspace (*arg))
if ((*arg != '\0') && !c_isspace (*arg))
error (_("Junk at end of arguments."));
if (ex_event != EX_EVENT_THROW

View File

@@ -66,12 +66,12 @@ find_next_token (const char **curr, parse_direction direction)
{
gdb_assert (direction == parse_direction::backward);
while (isspace (**curr))
while (c_isspace (**curr))
--(*curr);
tok_end = *curr;
while (!isspace (**curr))
while (!c_isspace (**curr))
--(*curr);
tok_start = (*curr) + 1;

View File

@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
#include <ctype.h>
#include "event-top.h"
#include "exceptions.h"
#include "gdbsupport/gdb_vecs.h"
@@ -1288,7 +1287,7 @@ condition_completer (struct cmd_list_element *cmd,
{
tracker.advance_custom_word_point_by (1);
/* We don't support completion of history indices. */
if (!isdigit (text[1]))
if (!c_isdigit (text[1]))
complete_internalvar (tracker, &text[1]);
return;
}
@@ -10465,7 +10464,7 @@ watch_command_1 (const char *arg, int accessflag, int from_tty,
int len;
len = exp_end - exp_start;
while (len > 0 && isspace (exp_start[len - 1]))
while (len > 0 && c_isspace (exp_start[len - 1]))
len--;
error (_("Cannot watch constant value `%.*s'."), len, exp_start);
}
@@ -14111,7 +14110,7 @@ strace_command (const char *arg, int from_tty)
/* Decide if we are dealing with a static tracepoint marker (`-m'),
or with a normal static tracepoint. */
if (arg && startswith (arg, "-m") && isspace (arg[2]))
if (arg && startswith (arg, "-m") && c_isspace (arg[2]))
{
ops = &strace_marker_breakpoint_ops;
locspec = new_linespec_location_spec (&arg,

View File

@@ -39,7 +39,6 @@
#include "record-btrace.h"
#include <inttypes.h>
#include <ctype.h>
#include <algorithm>
#include <string>
@@ -3258,7 +3257,7 @@ get_uint (const char **arg)
begin = *arg;
pos = skip_spaces (begin);
if (!isdigit (*pos))
if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
number = strtoul (pos, &end, 10);
@@ -3277,7 +3276,7 @@ get_context_size (const char **arg)
{
const char *pos = skip_spaces (*arg);
if (!isdigit (*pos))
if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
char *end;

View File

@@ -35,7 +35,6 @@
%{
#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"

View File

@@ -33,7 +33,6 @@
#include "cp-abi.h"
#include "cp-support.h"
#include "gdbsupport/gdb_obstack.h"
#include <ctype.h>
#include "gdbcore.h"
#include "gdbarch.h"
#include "c-exp.h"

View File

@@ -24,7 +24,6 @@
#include "charset-list.h"
#include "gdbsupport/environ.h"
#include "arch-utils.h"
#include <ctype.h>
#ifdef USE_WIN32API
#include <windows.h>

View File

@@ -301,8 +301,8 @@ with_command_completer_1 (const char *set_cmd_prefix,
command as if it was a "set" command. */
if (delim == text
|| delim == nullptr
|| !isspace (delim[-1])
|| !(isspace (delim[2]) || delim[2] == '\0'))
|| !c_isspace (delim[-1])
|| !(c_isspace (delim[2]) || delim[2] == '\0'))
{
std::string new_text = std::string (set_cmd_prefix) + text;
tracker.advance_custom_word_point_by (-(int) strlen (set_cmd_prefix));
@@ -785,14 +785,14 @@ source_command (const char *args, int from_tty)
if (args[0] != '-')
break;
if (args[1] == 'v' && isspace (args[2]))
if (args[1] == 'v' && c_isspace (args[2]))
{
source_verbose = 1;
/* Skip passed -v. */
args = &args[3];
}
else if (args[1] == 's' && isspace (args[2]))
else if (args[1] == 's' && c_isspace (args[2]))
{
search_path = 1;
@@ -1184,7 +1184,7 @@ pipe_command_completer (struct cmd_list_element *ignore,
delimiter = opts.delimiter.c_str ();
/* Check if we're past option values already. */
if (text > org_text && !isspace (text[-1]))
if (text > org_text && !c_isspace (text[-1]))
return;
const char *delim = strstr (text, delimiter);
@@ -1669,7 +1669,7 @@ disassemble_command (const char *arg, int from_tty)
if (*p == '\0')
error (_("Missing modifier."));
while (*p && ! isspace (*p))
while (*p && ! c_isspace (*p))
{
switch (*p++)
{
@@ -1938,8 +1938,8 @@ alias_command_completer (struct cmd_list_element *ignore,
typing COMMAND DEFAULT-ARGS... */
if (delim != text
&& delim != nullptr
&& isspace (delim[-1])
&& (isspace (delim[1]) || delim[1] == '\0'))
&& c_isspace (delim[-1])
&& (c_isspace (delim[1]) || delim[1] == '\0'))
{
std::string new_text = std::string (delim + 1);

View File

@@ -16,7 +16,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "symtab.h"
#include <ctype.h>
#include "gdbsupport/gdb_regex.h"
#include "completer.h"
#include "ui-out.h"
@@ -2053,8 +2052,8 @@ print_doc_line (struct ui_file *stream, const char *str,
if (for_value_prefix)
{
char &c = (*line_buffer)[0];
if (islower (c))
c = toupper (c);
if (c_islower (c))
c = c_toupper (c);
if (line_buffer->back () == '.')
line_buffer->pop_back ();
}
@@ -2227,7 +2226,7 @@ valid_cmd_char_p (int c)
/* Alas "42" is a legitimate user-defined command.
In the interests of not breaking anything we preserve that. */
return isalnum (c) || c == '-' || c == '_' || c == '.';
return c_isalnum (c) || c == '-' || c == '_' || c == '.';
}
/* See command.h. */
@@ -2491,7 +2490,7 @@ lookup_cmd (const char **line, struct cmd_list_element *list,
}
else
{
if (c->type == set_cmd && **line != '\0' && !isspace (**line))
if (c->type == set_cmd && **line != '\0' && !c_isspace (**line))
error (_("Argument must be preceded by space."));
/* We've got something. It may still not be what the caller

View File

@@ -23,7 +23,6 @@
#include "cli/cli-cmds.h"
#include "value.h"
#include "completer.h"
#include <ctype.h>
#include "target.h"
#include "readline/tilde.h"
#include "gdbcore.h"

View File

@@ -227,7 +227,7 @@ parse_option (gdb::array_view<const option_def_group> options_group,
match = &o;
match_ctx = grp.ctx;
if ((isspace (arg[len]) || arg[len] == '\0')
if ((c_isspace (arg[len]) || arg[len] == '\0')
&& strlen (o.name) == len)
break; /* Exact match. */
}
@@ -635,7 +635,7 @@ complete_options (completion_tracker &tracker,
if (ov
&& !tracker.have_completions ()
&& **args == '\0'
&& *args > text && !isspace ((*args)[-1]))
&& *args > text && !c_isspace ((*args)[-1]))
{
tracker.advance_custom_word_point_by
(*args - text);

View File

@@ -19,7 +19,6 @@
#include "event-top.h"
#include "value.h"
#include <ctype.h>
#include "ui-out.h"
#include "top.h"
@@ -829,7 +828,7 @@ locate_arg (const char *p)
while ((p = strchr (p, '$')))
{
if (startswith (p, "$arg")
&& (isdigit (p[4]) || p[4] == 'c'))
&& (c_isdigit (p[4]) || p[4] == 'c'))
return p;
p++;
}
@@ -1324,9 +1323,9 @@ validate_comname (const char **comname)
/* Find the last word of the argument. */
p = *comname + strlen (*comname);
while (p > *comname && isspace (p[-1]))
while (p > *comname && c_isspace (p[-1]))
p--;
while (p > *comname && !isspace (p[-1]))
while (p > *comname && !c_isspace (p[-1]))
p--;
last_word = p;

View File

@@ -17,7 +17,6 @@
#include "readline/tilde.h"
#include "value.h"
#include <ctype.h>
#include "arch-utils.h"
#include "observable.h"
#include "interps.h"
@@ -49,7 +48,7 @@ parse_auto_binary_operation (const char *arg)
{
int length = strlen (arg);
while (isspace (arg[length - 1]) && length > 0)
while (c_isspace (arg[length - 1]) && length > 0)
length--;
/* Note that "o" is ambiguous. */

View File

@@ -20,7 +20,6 @@
#include "cli/cli-utils.h"
#include "value.h"
#include <ctype.h>
/* See documentation in cli-utils.h. */
@@ -46,7 +45,7 @@ get_ulongest (const char **pp, int trailer)
/* Internal variable. Make a copy of the name, so we can
null-terminate it to pass to lookup_internalvar(). */
const char *start = ++p;
while (isalnum (*p) || *p == '_')
while (c_isalnum (*p) || *p == '_')
p++;
std::string varname (start, p - start);
if (!get_internalvar_integer (lookup_internalvar (varname.c_str ()),
@@ -67,7 +66,7 @@ get_ulongest (const char **pp, int trailer)
p = end;
}
if (!(isspace (*p) || *p == '\0' || *p == trailer))
if (!(c_isspace (*p) || *p == '\0' || *p == trailer))
error (_("Trailing junk at: %s"), p);
p = skip_spaces (p);
*pp = p;
@@ -111,7 +110,7 @@ get_number_trailer (const char **pp, int trailer)
const char *start = ++p;
LONGEST longest_val;
while (isalnum (*p) || *p == '_')
while (c_isalnum (*p) || *p == '_')
p++;
varname = (char *) alloca (p - start + 1);
strncpy (varname, start, p - start);
@@ -136,7 +135,7 @@ get_number_trailer (const char **pp, int trailer)
/* There is no number here. (e.g. "cond a == b"). */
{
/* Skip non-numeric token. */
while (*p && !isspace((int) *p))
while (*p && !c_isspace((int) *p))
++p;
/* Return zero, which caller must interpret as error. */
retval = 0;
@@ -144,10 +143,10 @@ get_number_trailer (const char **pp, int trailer)
else
retval = atoi (p1);
}
if (!(isspace (*p) || *p == '\0' || *p == trailer))
if (!(c_isspace (*p) || *p == '\0' || *p == trailer))
{
/* Trailing junk: return 0 and let caller print error msg. */
while (!(isspace (*p) || *p == '\0' || *p == trailer))
while (!(c_isspace (*p) || *p == '\0' || *p == trailer))
++p;
retval = 0;
}
@@ -262,8 +261,8 @@ number_or_range_parser::get_number ()
option rather than an incomplete range, so check for end of
string as well. */
if (m_cur_tok[0] == '-'
&& !(isspace (m_cur_tok[-1])
&& (isalpha (m_cur_tok[1])
&& !(c_isspace (m_cur_tok[-1])
&& (c_isalpha (m_cur_tok[1])
|| m_cur_tok[1] == '-'
|| m_cur_tok[1] == '\0')))
{
@@ -293,7 +292,7 @@ number_or_range_parser::get_number ()
}
else
{
if (isdigit (*(m_cur_tok + 1)))
if (c_isdigit (*(m_cur_tok + 1)))
error (_("negative value"));
if (*(m_cur_tok + 1) == '$')
{
@@ -330,9 +329,9 @@ number_or_range_parser::finished () const
integer, convenience var or negative convenience var. */
return (m_cur_tok == NULL || *m_cur_tok == '\0'
|| (!m_in_range
&& !(isdigit (*m_cur_tok) || *m_cur_tok == '$')
&& !(c_isdigit (*m_cur_tok) || *m_cur_tok == '$')
&& !(*m_cur_tok == '-'
&& (isdigit (m_cur_tok[1]) || m_cur_tok[1] == '$'))));
&& (c_isdigit (m_cur_tok[1]) || m_cur_tok[1] == '$'))));
}
/* Accept a number and a string-form list of numbers such as is
@@ -370,7 +369,7 @@ number_is_in_list (const char *list, int number)
const char *
remove_trailing_whitespace (const char *start, const char *s)
{
while (s > start && isspace (*(s - 1)))
while (s > start && c_isspace (*(s - 1)))
--s;
return s;
@@ -420,7 +419,7 @@ int
check_for_argument (const char **str, const char *arg, int arg_len)
{
if (strncmp (*str, arg, arg_len) == 0
&& ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len])))
&& ((*str)[arg_len] == '\0' || c_isspace ((*str)[arg_len])))
{
*str += arg_len;
*str = skip_spaces (*str);

View File

@@ -35,7 +35,6 @@
#include "gdbsupport/common-utils.h"
#include "coff/internal.h"
#include <ctype.h>
/* Internal section information */
@@ -189,7 +188,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
int i;
for (i = 0; i < forward_dll_name_len; i++)
forward_qualified_name[i] = tolower (forward_qualified_name[i]);
forward_qualified_name[i] = c_tolower (forward_qualified_name[i]);
msymbol = lookup_minimal_symbol (current_program_space,
forward_qualified_name.c_str ());
}

View File

@@ -25,7 +25,6 @@
#include "bfd.h"
#include "gdbsupport/gdb_obstack.h"
#include <ctype.h>
#include "coff/internal.h"
#include "libcoff.h"
@@ -336,7 +335,7 @@ coff_locate_sections (bfd *abfd, asection *sectp, void *csip)
/* 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 (!c_isdigit (*s))
break;
if (*s == '\0')
csi->stabsects->push_back (sectp);
@@ -525,9 +524,9 @@ is_import_fixup_symbol (struct coff_symbol *cs,
/* The name must start with "__fu<digits>__". */
if (!startswith (cs->c_name, "__fu"))
return 0;
if (! isdigit (cs->c_name[4]))
if (! c_isdigit (cs->c_name[4]))
return 0;
for (i = 5; cs->c_name[i] != '\0' && isdigit (cs->c_name[i]); i++)
for (i = 5; cs->c_name[i] != '\0' && c_isdigit (cs->c_name[i]); i++)
/* Nothing, just incrementing index past all digits. */;
if (cs->c_name[i] != '_' || cs->c_name[i + 1] != '_')
return 0;

View File

@@ -38,7 +38,6 @@
%{
#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -684,15 +683,15 @@ parse_number (struct parser_state *ps, const char *p,
len = strlen (s);
/* Check suffix for `i' , `fi' or `li' (idouble, ifloat or ireal). */
if (len >= 1 && tolower (s[len - 1]) == 'i')
if (len >= 1 && c_tolower (s[len - 1]) == 'i')
{
if (len >= 2 && tolower (s[len - 2]) == 'f')
if (len >= 2 && c_tolower (s[len - 2]) == 'f')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_ifloat;
len -= 2;
}
else if (len >= 2 && tolower (s[len - 2]) == 'l')
else if (len >= 2 && c_tolower (s[len - 2]) == 'l')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_ireal;
@@ -706,13 +705,13 @@ parse_number (struct parser_state *ps, const char *p,
}
}
/* Check suffix for `f' or `l'' (float or real). */
else if (len >= 1 && tolower (s[len - 1]) == 'f')
else if (len >= 1 && c_tolower (s[len - 1]) == 'f')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_float;
len -= 1;
}
else if (len >= 1 && tolower (s[len - 1]) == 'l')
else if (len >= 1 && c_tolower (s[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_d_type (ps)->builtin_real;
@@ -1133,8 +1132,8 @@ lex_one_token (struct parser_state *par_state)
/* Hex exponents start with 'p', because 'e' is a valid hex
digit and thus does not indicate a floating point number
when the radix is hex. */
if ((!hex && !got_e && tolower (p[0]) == 'e')
|| (hex && !got_e && tolower (p[0] == 'p')))
if ((!hex && !got_e && c_tolower (p[0]) == 'e')
|| (hex && !got_e && c_tolower (p[0] == 'p')))
got_dot = got_e = 1;
/* A '.' always indicates a decimal floating point number
regardless of the radix. If we have a '..' then its the
@@ -1142,7 +1141,8 @@ lex_one_token (struct parser_state *par_state)
else if (!got_dot && (p[0] == '.' && p[1] != '.'))
got_dot = 1;
/* This is the sign of the exponent, not the end of the number. */
else if (got_e && (tolower (p[-1]) == 'e' || tolower (p[-1]) == 'p')
else if (got_e && (c_tolower (p[-1]) == 'e'
|| c_tolower (p[-1]) == 'p')
&& (*p == '-' || *p == '+'))
continue;
/* We will take any letters or digits, ignoring any embedded '_'.
@@ -1167,9 +1167,9 @@ lex_one_token (struct parser_state *par_state)
const char *p = &tokstart[1];
size_t len = strlen ("entry");
while (isspace (*p))
while (c_isspace (*p))
p++;
if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
if (strncmp (p, "entry", len) == 0 && !c_isalnum (p[len])
&& p[len] != '_')
{
pstate->lexptr = &p[len];

View File

@@ -47,7 +47,6 @@
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <ctype.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
#include <libproc.h>

View File

@@ -20,7 +20,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "gdbsupport/gdb_obstack.h"
#include "symtab.h"
#include "buildsym.h"

View File

@@ -31,7 +31,7 @@ mapped_index_string_hash (int index_version, const void *p)
while ((c = *str++) != 0)
{
if (index_version >= 5)
c = tolower (c);
c = c_tolower (c);
r = r * 67 + c - 113;
}
@@ -45,12 +45,12 @@ dwarf5_djb_hash (const char *str_)
{
const unsigned char *str = (const unsigned char *) str_;
/* Note: tolower here ignores UTF-8, which isn't fully compliant.
/* Note: c_tolower here ignores UTF-8, which isn't fully compliant.
See http://dwarfstd.org/ShowIssue.php?issue=161027.1. */
uint32_t hash = 5381;
while (int c = *str++)
hash = hash * 33 + tolower (c);
hash = hash * 33 + c_tolower (c);
return hash;
}
@@ -59,11 +59,11 @@ dwarf5_djb_hash (const char *str_)
uint32_t
dwarf5_djb_hash (std::string_view str)
{
/* Note: tolower here ignores UTF-8, which isn't fully compliant.
/* Note: c_tolower here ignores UTF-8, which isn't fully compliant.
See http://dwarfstd.org/ShowIssue.php?issue=161027.1. */
uint32_t hash = 5381;
for (char c : str)
hash = hash * 33 + tolower (c & 0xff);
hash = hash * 33 + c_tolower (c & 0xff);
return hash;
}

View File

@@ -13440,7 +13440,7 @@ ada_get_gnat_encoded_number (const char *encoding, int &k, gdb_mpz *result)
{
/* The next character should be an underscore ('_') followed
by a digit. */
if (encoding[k] != '_' || !isdigit (encoding[k + 1]))
if (encoding[k] != '_' || !c_isdigit (encoding[k + 1]))
return false;
/* Skip the underscore. */
@@ -13448,7 +13448,7 @@ ada_get_gnat_encoded_number (const char *encoding, int &k, gdb_mpz *result)
int start = k;
/* Determine the number of digits for our number. */
while (isdigit (encoding[k]))
while (c_isdigit (encoding[k]))
k++;
if (k == start)
return false;

View File

@@ -38,7 +38,6 @@
#include "gdbsupport/gdb_obstack.h"
#include "objfiles.h"
#include "typeprint.h"
#include <ctype.h>
#include "expop.h"
#include "c-exp.h"
#include "inferior.h"

View File

@@ -42,7 +42,6 @@
#include "readline/tilde.h"
#include "gdbcore.h"
#include <ctype.h>
#include <sys/stat.h>
#include "solib.h"
#include <algorithm>
@@ -1015,7 +1014,7 @@ set_section_command (const char *args, int from_tty)
error (_("Must specify section name and its virtual address"));
/* Parse out section name. */
for (secname = args; !isspace (*args); args++);
for (secname = args; !c_isspace (*args); args++);
unsigned seclen = args - secname;
/* Parse out new virtual address. */

View File

@@ -33,7 +33,6 @@
#include "expop.h"
#include "ada-exp.h"
#include <ctype.h>
/* Meant to be used in debug sessions, so don't export it in a header file. */
extern void ATTRIBUTE_USED debug_exp (struct expression *exp);

View File

@@ -48,7 +48,6 @@
#include "language.h"
#include "f-lang.h"
#include "block.h"
#include <ctype.h>
#include <algorithm>
#include "type-stack.h"
#include "f-exp.h"
@@ -1061,8 +1060,8 @@ parse_number (struct parser_state *par_state,
while (len-- > 0)
{
c = *p++;
if (isupper (c))
c = tolower (c);
if (c_isupper (c))
c = c_tolower (c);
if (len == 0 && c == 'l')
long_p = 1;
else if (len == 0 && c == 'u')

View File

@@ -304,7 +304,7 @@ fbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (pid == 0)
error (_("No current process: you must name one."));
}
else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
else if (built_argv.count () == 1 && c_isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
else
error (_("Invalid arguments."));

View File

@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "arch-utils.h"
#include <ctype.h>
#include "cli/cli-cmds.h"
#include "value.h"
#include "target.h"
@@ -76,12 +75,12 @@ parse_find_args (const char *args, ULONGEST *max_countp,
{
++s;
while (*s != '\0' && *s != '/' && !isspace (*s))
while (*s != '\0' && *s != '/' && !c_isspace (*s))
{
if (isdigit (*s))
if (c_isdigit (*s))
{
max_count = atoi (s);
while (isdigit (*s))
while (c_isdigit (*s))
++s;
continue;
}

View File

@@ -113,8 +113,8 @@ typedef char gdb_wchar_t;
typedef int gdb_wint_t;
#define gdb_wcslen strlen
#define gdb_iswprint isprint
#define gdb_iswxdigit isxdigit
#define gdb_iswprint c_isprint
#define gdb_iswxdigit c_isxdigit
#define gdb_btowc /* empty */
#define gdb_WEOF EOF

View File

@@ -50,7 +50,6 @@ extern "C"
}
#include <ctype.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/ptrace.h>
@@ -2926,7 +2925,7 @@ set_sig_thread_cmd (const char *args, int from_tty)
{
struct inf *inf = cur_inf ();
if (!args || (!isdigit (*args) && strcmp (args, "none") != 0))
if (!args || (!c_isdigit (*args) && strcmp (args, "none") != 0))
error (_("Illegal argument to \"set signal-thread\" command.\n"
"Should be a thread ID, or \"none\"."));

View File

@@ -26,7 +26,6 @@
#include "gdb-demangle.h"
#include "cp-abi.h"
#include "cp-support.h"
#include <ctype.h>
static cp_abi_ops gnu_v2_abi_ops;
@@ -46,7 +45,7 @@ static enum ctor_kinds
gnuv2_is_constructor_name (const char *name)
{
if ((name[0] == '_' && name[1] == '_'
&& (isdigit (name[2]) || strchr ("Qt", name[2])))
&& (c_isdigit (name[2]) || strchr ("Qt", name[2])))
|| startswith (name, "__ct__"))
return complete_object_ctor;
else

View File

@@ -51,7 +51,6 @@
%{
#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -663,13 +662,13 @@ parse_number (struct parser_state *par_state,
/* Handle suffixes: 'f' for float32, 'l' for long double.
FIXME: This appears to be an extension -- do we want this? */
if (len >= 1 && tolower (p[len - 1]) == 'f')
if (len >= 1 && c_tolower (p[len - 1]) == 'f')
{
putithere->typed_val_float.type
= builtin_go_types->builtin_float32;
len--;
}
else if (len >= 1 && tolower (p[len - 1]) == 'l')
else if (len >= 1 && c_tolower (p[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_long_double;
@@ -1113,9 +1112,9 @@ lex_one_token (struct parser_state *par_state)
const char *p = &tokstart[1];
size_t len = strlen ("entry");
while (isspace (*p))
while (c_isspace (*p))
p++;
if (strncmp (p, "entry", len) == 0 && !isalnum (p[len])
if (strncmp (p, "entry", len) == 0 && !c_isalnum (p[len])
&& p[len] != '_')
{
par_state->lexptr = &p[len];

View File

@@ -41,7 +41,6 @@
#include "parser-defs.h"
#include "gdbarch.h"
#include <ctype.h>
/* The main function in the main package. */
static const char GO_MAIN_MAIN[] = "main.main";
@@ -292,7 +291,7 @@ unpack_mangled_go_symbol (const char *mangled_name,
while (p > buf)
{
int current = *(const unsigned char *) --p;
int current_is_digit = isdigit (current);
int current_is_digit = c_isdigit (current);
if (saw_digit)
{

View File

@@ -103,7 +103,6 @@
#include "cli/cli-utils.h"
#include "inf-child.h"
#include <ctype.h>
#include <unistd.h>
#include <sys/utsname.h>
#include <io.h>

View File

@@ -20,7 +20,6 @@
/* See README file in this directory for implementation notes, coding
conventions, et.al. */
#include <ctype.h>
#include "charset.h"
#include "cli/cli-cmds.h"
#include "cli/cli-decode.h"

View File

@@ -61,7 +61,6 @@
#include "stap-probe.h"
#include "user-regs.h"
#include "expression.h"
#include <ctype.h>
#include <algorithm>
#include <unordered_set>
#include "producer.h"
@@ -3895,9 +3894,9 @@ int
i386_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == '$' /* Literal number. */
|| (isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */
|| (c_isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement. */
|| (*s == '(' && s[1] == '%') /* Register indirection. */
|| (*s == '%' && isalpha (s[1]))); /* Register access. */
|| (*s == '%' && c_isalpha (s[1]))); /* Register access. */
}
/* Helper function for i386_stap_parse_special_token.
@@ -3914,7 +3913,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
{
const char *s = p->arg;
if (isdigit (*s) || *s == '-' || *s == '+')
if (c_isdigit (*s) || *s == '-' || *s == '+')
{
bool got_minus[3];
int i;
@@ -3932,7 +3931,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
got_minus[0] = true;
}
if (!isdigit ((unsigned char) *s))
if (!c_isdigit (*s))
return {};
displacements[0] = strtol (s, &endp, 10);
@@ -3953,7 +3952,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
got_minus[1] = true;
}
if (!isdigit ((unsigned char) *s))
if (!c_isdigit (*s))
return {};
displacements[1] = strtol (s, &endp, 10);
@@ -3974,7 +3973,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
got_minus[2] = true;
}
if (!isdigit ((unsigned char) *s))
if (!c_isdigit (*s))
return {};
displacements[2] = strtol (s, &endp, 10);
@@ -3986,7 +3985,7 @@ i386_stap_parse_special_token_triplet (struct gdbarch *gdbarch,
s += 2;
start = s;
while (isalnum (*s))
while (c_isalnum (*s))
++s;
if (*s++ != ')')
@@ -4047,7 +4046,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
{
const char *s = p->arg;
if (isdigit (*s) || *s == '(' || *s == '-' || *s == '+')
if (c_isdigit (*s) || *s == '(' || *s == '-' || *s == '+')
{
bool offset_minus = false;
long offset = 0;
@@ -4065,10 +4064,10 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
offset_minus = true;
}
if (offset_minus && !isdigit (*s))
if (offset_minus && !c_isdigit (*s))
return {};
if (isdigit (*s))
if (c_isdigit (*s))
{
char *endp;
@@ -4082,7 +4081,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
s += 2;
start = s;
while (isalnum (*s))
while (c_isalnum (*s))
++s;
if (*s != ',' || s[1] != '%')
@@ -4098,7 +4097,7 @@ i386_stap_parse_special_token_three_arg_disp (struct gdbarch *gdbarch,
s += 2;
start = s;
while (isalnum (*s))
while (c_isalnum (*s))
++s;
len_index = s - start;

View File

@@ -29,7 +29,6 @@
#include "solib-svr4-linux.h"
#include "regset.h"
#include <ctype.h>
/* The sigtramp code is in a non-readable (executable-only) region
of memory called the ``gate page''. The addresses in question
@@ -128,9 +127,9 @@ ia64_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
static int
ia64_linux_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return ((isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */
return ((c_isdigit (*s) && s[1] == '[' && s[2] == 'r') /* Displacement. */
|| *s == 'r' /* Register value. */
|| isdigit (*s)); /* Literal number. */
|| c_isdigit (*s)); /* Literal number. */
}
/* Core file support. */

View File

@@ -40,7 +40,6 @@
#include "reggroups.h"
#include "block.h"
#include "solib.h"
#include <ctype.h>
#include "observable.h"
#include "target-descriptions.h"
#include "user-regs.h"
@@ -210,7 +209,7 @@ strip_bg_char (const char *args, int *bg_char_p)
if (p[-1] == '&')
{
p--;
while (p > args && isspace (p[-1]))
while (p > args && c_isspace (p[-1]))
p--;
*bg_char_p = 1;
@@ -2309,12 +2308,12 @@ registers_info (const char *addr_exp, int fpregs)
resembling a register following it. */
if (addr_exp[0] == '$')
addr_exp++;
if (isspace ((*addr_exp)) || (*addr_exp) == '\0')
if (c_isspace ((*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' && !c_isspace ((*addr_exp)))
addr_exp++;
end = addr_exp;

View File

@@ -22,7 +22,6 @@
#include "cli/cli-style.h"
#include "displaced-stepping.h"
#include "infrun.h"
#include <ctype.h>
#include "exceptions.h"
#include "symtab.h"
#include "frame.h"
@@ -9843,7 +9842,7 @@ handle_command (const char *args, int from_tty)
for (char *arg : built_argv)
{
wordlen = strlen (arg);
for (digits = 0; isdigit (arg[digits]); digits++)
for (digits = 0; c_isdigit (arg[digits]); digits++)
{;
}
allsigs = 0;

View File

@@ -28,7 +28,6 @@
return data out of a "language-specific" struct pointer that is set
whenever the working language changes. That would be a lot faster. */
#include <ctype.h>
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"

View File

@@ -35,7 +35,6 @@
#include "interps.h"
#include "target.h"
#include "arch-utils.h"
#include <ctype.h>
#include "cli/cli-utils.h"
#include "filenames.h"
#include "ada-lang.h"
@@ -459,7 +458,7 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
++(parser->lexer.stream);
}
while (isdigit (*parser->lexer.stream))
while (c_isdigit (*parser->lexer.stream))
{
++tokenp->data.string.length;
++(parser->lexer.stream);
@@ -468,7 +467,7 @@ linespec_lexer_lex_number (linespec_parser *parser, linespec_token *tokenp)
/* If the next character in the input buffer is not a space, comma,
quote, or colon, this input does not represent a number. */
if (*parser->lexer.stream != '\0'
&& !isspace (*parser->lexer.stream) && *parser->lexer.stream != ','
&& !c_isspace (*parser->lexer.stream) && *parser->lexer.stream != ','
&& *parser->lexer.stream != ':'
&& !strchr (linespec_quote_characters, *parser->lexer.stream))
{
@@ -512,7 +511,7 @@ linespec_lexer_lex_keyword (const char *p)
if (i == FORCE_KEYWORD_INDEX && p[len] == '\0')
return linespec_keywords[i];
if (!isspace (p[len]))
if (!c_isspace (p[len]))
continue;
if (i == FORCE_KEYWORD_INDEX)
@@ -524,7 +523,7 @@ linespec_lexer_lex_keyword (const char *p)
int nextlen = strlen (linespec_keywords[j]);
if (strncmp (p, linespec_keywords[j], nextlen) == 0
&& isspace (p[nextlen]))
&& c_isspace (p[nextlen]))
return linespec_keywords[i];
}
}
@@ -538,7 +537,7 @@ linespec_lexer_lex_keyword (const char *p)
int nextlen = strlen (linespec_keywords[j]);
if (strncmp (p, linespec_keywords[j], nextlen) == 0
&& isspace (p[nextlen]))
&& c_isspace (p[nextlen]))
return NULL;
}
}
@@ -763,7 +762,7 @@ linespec_lexer_lex_string (linespec_parser *parser)
while (1)
{
if (isspace (*parser->lexer.stream))
if (c_isspace (*parser->lexer.stream))
{
p = skip_spaces (parser->lexer.stream);
/* When we get here we know we've found something followed by
@@ -841,14 +840,14 @@ linespec_lexer_lex_string (linespec_parser *parser)
{
const char *op = parser->lexer.stream;
while (op > start && isspace (op[-1]))
while (op > start && c_isspace (op[-1]))
op--;
if (op - start >= CP_OPERATOR_LEN)
{
op -= CP_OPERATOR_LEN;
if (strncmp (op, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
&& (op == start
|| !(isalnum (op[-1]) || op[-1] == '_')))
|| !(c_isalnum (op[-1]) || op[-1] == '_')))
{
/* This is an operator name. Keep going. */
++(parser->lexer.stream);
@@ -1642,7 +1641,7 @@ linespec_parse_line_offset (const char *string)
else
line_offset.sign = LINE_OFFSET_NONE;
if (*string != '\0' && !isdigit (*string))
if (*string != '\0' && !c_isdigit (*string))
error (_("malformed line offset: \"%s\""), start);
/* Right now, we only allow base 10 for offsets. */

View File

@@ -37,7 +37,6 @@
#include "gdbsupport/eintr.h"
#include "target/waitstatus.h"
#include <dirent.h>
#include <ctype.h>
#include <list>
@@ -421,7 +420,7 @@ fork_save_infrun_state (struct fork_info *fp)
/* Now find actual file positions. */
rewinddir (d);
while ((de = readdir (d)) != NULL)
if (isdigit (de->d_name[0]))
if (c_isdigit (de->d_name[0]))
{
tmp = strtol (&de->d_name[0], NULL, 10);
fp->filepos[tmp] = call_lseek (tmp, 0, SEEK_CUR);

View File

@@ -42,7 +42,6 @@
#include "elf-bfd.h"
#include "gregset.h"
#include "gdbcore.h"
#include <ctype.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "inf-loop.h"

View File

@@ -46,7 +46,6 @@
#include "cli/cli-style.h"
#include "gdbsupport/unordered_map.h"
#include <ctype.h>
#include <algorithm>
/* This enum represents the values that the user can choose when
@@ -488,7 +487,7 @@ read_mapping (const char *line)
p = skip_spaces (p);
const char *permissions_start = p;
while (*p && !isspace (*p))
while (*p && !c_isspace (*p))
p++;
mapping.permissions = std::string (permissions_start,
(size_t) (p - permissions_start));
@@ -497,7 +496,7 @@ read_mapping (const char *line)
p = skip_spaces (p);
const char *device_start = p;
while (*p && !isspace (*p))
while (*p && !c_isspace (*p))
p++;
mapping.device = {device_start, (size_t) (p - device_start)};
@@ -843,7 +842,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
char filename[100];
fileio_error target_errno;
if (args && isdigit (args[0]))
if (args && c_isdigit (args[0]))
{
char *tem;
@@ -2227,7 +2226,7 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
specifically under the entry of `/proc/[pid]/stat'. */
/* Getting rid of the PID, since we already have it. */
while (isdigit (*proc_stat))
while (c_isdigit (*proc_stat))
++proc_stat;
proc_stat = skip_spaces (proc_stat);
@@ -2299,10 +2298,10 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* Advancing the pointer to the beginning of the UID. */
tmpstr += sizeof ("Uid:");
while (*tmpstr != '\0' && !isdigit (*tmpstr))
while (*tmpstr != '\0' && !c_isdigit (*tmpstr))
++tmpstr;
if (isdigit (*tmpstr))
if (c_isdigit (*tmpstr))
p->pr_uid = strtol (tmpstr, &tmpstr, 10);
}
@@ -2312,10 +2311,10 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
{
/* Advancing the pointer to the beginning of the GID. */
tmpstr += sizeof ("Gid:");
while (*tmpstr != '\0' && !isdigit (*tmpstr))
while (*tmpstr != '\0' && !c_isdigit (*tmpstr))
++tmpstr;
if (isdigit (*tmpstr))
if (c_isdigit (*tmpstr))
p->pr_gid = strtol (tmpstr, &tmpstr, 10);
}

View File

@@ -43,7 +43,6 @@
#include "auto-load.h"
#include "cli/cli-utils.h"
#include <signal.h>
#include <ctype.h>
#include "nat/linux-namespaces.h"
#include <algorithm>
#include "gdbsupport/pathstuff.h"

View File

@@ -26,7 +26,6 @@
#include "probe.h"
#include "cp-support.h"
#include <ctype.h>
#include <string.h>
static std::string
@@ -408,15 +407,15 @@ explicit_location_spec_lex_one (const char **inp,
whitespace or comma. */
if (*start == '-' || *start == '+')
{
while (*inp[0] != '\0' && *inp[0] != ',' && !isspace (*inp[0]))
while (*inp[0] != '\0' && *inp[0] != ',' && !c_isspace (*inp[0]))
++(*inp);
}
else
{
/* Handle numbers first, stopping at the next whitespace or ','. */
while (isdigit (*inp[0]))
while (c_isdigit (*inp[0]))
++(*inp);
if (*inp[0] == '\0' || isspace (*inp[0]) || *inp[0] == ',')
if (*inp[0] == '\0' || c_isspace (*inp[0]) || *inp[0] == ',')
return gdb::unique_xmalloc_ptr<char> (savestring (start,
*inp - start));
@@ -425,7 +424,7 @@ explicit_location_spec_lex_one (const char **inp,
*inp = start;
while ((*inp)[0]
&& (*inp)[0] != ','
&& !(isspace ((*inp)[0])
&& !(c_isspace ((*inp)[0])
|| linespec_lexer_lex_keyword (&(*inp)[1])))
{
/* Special case: C++ operator,. */
@@ -454,14 +453,14 @@ is_cp_operator (const char *start, const char *comma)
{
const char *p = comma;
while (p > start && isspace (p[-1]))
while (p > start && c_isspace (p[-1]))
p--;
if (p - start >= CP_OPERATOR_LEN)
{
p -= CP_OPERATOR_LEN;
if (strncmp (p, CP_OPERATOR_STR, CP_OPERATOR_LEN) == 0
&& (p == start
|| !(isalnum (p[-1]) || p[-1] == '_')))
|| !(c_isalnum (p[-1]) || p[-1] == '_')))
{
return true;
}
@@ -624,7 +623,7 @@ string_to_explicit_location_spec (const char **argp,
if (argp == NULL
|| *argp == NULL
|| *argp[0] != '-'
|| !isalpha ((*argp)[1])
|| !c_isalpha ((*argp)[1])
|| ((*argp)[0] == '-' && (*argp)[1] == 'p'))
return NULL;
@@ -728,7 +727,7 @@ string_to_explicit_location_spec (const char **argp,
}
/* Only emit an "invalid argument" error for options
that look like option strings. */
else if (opt.get ()[0] == '-' && !isdigit (opt.get ()[1]))
else if (opt.get ()[0] == '-' && !c_isdigit (opt.get ()[1]))
{
if (completion_info == NULL)
error (_("invalid explicit location argument, \"%s\""), opt.get ());

View File

@@ -30,7 +30,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <ctype.h>
#include "gdbsupport/event-loop.h"
#include "ui-out.h"
@@ -1254,7 +1253,7 @@ captured_main_1 (struct captured_main_args *context)
If pid_or_core_arg's first character is a digit, try attach
first and then corefile. Otherwise try just corefile. */
if (isdigit (pid_or_core_arg[0]))
if (c_isdigit (pid_or_core_arg[0]))
{
ret = catch_command_errors (attach_command, pid_or_core_arg,
!batch_flag);

View File

@@ -21,7 +21,6 @@
#include "arch-utils.h"
#include <ctype.h>
#include <cmath>
#include <signal.h>
#include "command.h"
@@ -571,9 +570,9 @@ maintenance_translate_address (const char *arg, int from_tty)
sect = NULL;
p = arg;
if (!isdigit (*p))
if (!c_isdigit (*p))
{ /* See if we have a valid section name. */
while (*p && !isspace (*p)) /* Find end of section name. */
while (*p && !c_isspace (*p)) /* Find end of section name. */
p++;
if (*p == '\000') /* End of command? */
error (_("Need to specify section name and address"));

View File

@@ -28,7 +28,6 @@
#include "language.h"
#include "location.h"
#include "linespec.h"
#include <ctype.h>
#include "tracepoint.h"
enum
@@ -133,7 +132,7 @@ mi_argv_to_format (const char *const *argv, int argc)
result += "\\\"";
break;
default:
if (isprint (argv[0][i]))
if (c_isprint (argv[0][i]))
result += argv[0][i];
else
{

View File

@@ -29,7 +29,6 @@
#include "valprint.h"
#include "mi-getopt.h"
#include "extension.h"
#include <ctype.h>
#include "mi-parse.h"
#include <optional>
#include "inferior.h"

View File

@@ -25,7 +25,6 @@
#include "varobj.h"
#include "language.h"
#include "value.h"
#include <ctype.h>
#include "mi-getopt.h"
#include "gdbthread.h"
#include "mi-parse.h"
@@ -109,7 +108,7 @@ mi_cmd_var_create (const char *command, const char *const *argv, int argc)
gen_name = varobj_gen_name ();
name = gen_name.c_str ();
}
else if (!isalpha (name[0]))
else if (!c_isalpha (name[0]))
error (_("-var-create: name of object must begin with a letter"));
if (strcmp (frame, "*") == 0)

View File

@@ -52,7 +52,6 @@
#include <optional>
#include "gdbsupport/byte-vector.h"
#include <ctype.h>
#include "gdbsupport/run-time-clock.h"
#include <chrono>
#include "progspace-and-thread.h"

View File

@@ -22,7 +22,6 @@
#include "mi-cmds.h"
#include "mi-parse.h"
#include <ctype.h>
#include "cli/cli-utils.h"
#include "language.h"
@@ -61,7 +60,7 @@ mi_parse_escape (const char **string_ptr)
while (++count < 3)
{
c = (**string_ptr);
if (isdigit (c) && c != '8' && c != '9')
if (c_isdigit (c) && c != '8' && c != '9')
{
(*string_ptr)++;
i *= 8;
@@ -162,7 +161,7 @@ mi_parse::parse_argv ()
return;
}
/* Insist on trailing white space. */
if (chp[1] != '\0' && !isspace (chp[1]))
if (chp[1] != '\0' && !c_isspace (chp[1]))
{
freeargv (argv);
return;
@@ -193,7 +192,7 @@ mi_parse::parse_argv ()
int len;
const char *start = chp;
while (*chp != '\0' && !isspace (*chp))
while (*chp != '\0' && !c_isspace (*chp))
{
chp++;
}
@@ -313,7 +312,7 @@ mi_parse::mi_parse (const char *cmd, std::string *token)
{
const char *tmp = chp + 1; /* discard ``-'' */
for (; *chp && !isspace (*chp); chp++)
for (; *chp && !c_isspace (*chp); chp++)
;
this->command = make_unique_xstrndup (tmp, chp - tmp);
}
@@ -391,7 +390,7 @@ mi_parse::mi_parse (const char *cmd, std::string *token)
else
break;
if (*chp != '\0' && !isspace (*chp))
if (*chp != '\0' && !c_isspace (*chp))
error (_("Invalid value for the '%s' option"), option);
chp = skip_spaces (chp);
}

View File

@@ -36,7 +36,6 @@
to figure out what full symbol table entries need to be read in. */
#include <ctype.h>
#include "maint.h"
#include "symtab.h"
#include "bfd.h"

View File

@@ -21,7 +21,6 @@
#include <sys/types.h>
#include <sys/sysinfo.h>
#include <ctype.h>
#include <utmp.h>
#include <time.h>
#include <unistd.h>
@@ -205,7 +204,7 @@ get_cores_used_by_process (PID_T pid, int *cores, const int num_cores)
PID_T tid;
int core;
if (!isdigit (dp->d_name[0])
if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
@@ -310,7 +309,7 @@ linux_xfer_osdata_processes ()
std::string cores_str;
int i;
if (!isdigit (dp->d_name[0])
if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
@@ -419,7 +418,7 @@ linux_xfer_osdata_processgroups ()
{
PID_T pid, pgid;
if (!isdigit (dp->d_name[0])
if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > MAX_PID_T_STRLEN)
continue;
@@ -483,7 +482,7 @@ linux_xfer_osdata_threads ()
struct stat statbuf;
char procentry[sizeof ("/proc/4294967295")];
if (!isdigit (dp->d_name[0])
if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > sizeof ("4294967295") - 1)
continue;
@@ -513,7 +512,7 @@ linux_xfer_osdata_threads ()
PID_T tid;
int core;
if (!isdigit (dp2->d_name[0])
if (!c_isdigit (dp2->d_name[0])
|| NAMELEN (dp2) > sizeof ("4294967295") - 1)
continue;
@@ -633,7 +632,7 @@ linux_xfer_osdata_fds ()
struct stat statbuf;
char procentry[sizeof ("/proc/4294967295")];
if (!isdigit (dp->d_name[0])
if (!c_isdigit (dp->d_name[0])
|| NAMELEN (dp) > sizeof ("4294967295") - 1)
continue;
@@ -662,7 +661,7 @@ linux_xfer_osdata_fds ()
char buf[1000];
ssize_t rslt;
if (!isdigit (dp2->d_name[0]))
if (!c_isdigit (dp2->d_name[0]))
continue;
std::string fdname

View File

@@ -318,7 +318,7 @@ nbsd_nat_target::info_proc (const char *args, enum info_proc_what what)
if (pid == 0)
error (_("No current process: you must name one."));
}
else if (built_argv.count () == 1 && isdigit (built_argv[0][0]))
else if (built_argv.count () == 1 && c_isdigit (built_argv[0][0]))
pid = strtol (built_argv[0], NULL, 10);
else
error (_("Invalid arguments."));

View File

@@ -46,7 +46,6 @@
#include "cli/cli-utils.h"
#include "c-exp.h"
#include <ctype.h>
#include <algorithm>
struct objc_object {
@@ -850,9 +849,9 @@ parse_selector (char *method, char **selector)
for (;;)
{
if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
if (c_isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
*s1++ = *s2;
else if (isspace (*s2))
else if (c_isspace (*s2))
;
else if ((*s2 == '\0') || (*s2 == '\''))
break;
@@ -914,7 +913,7 @@ parse_method (char *method, char *type, char **theclass,
s1++;
nclass = s1;
while (isalnum (*s1) || (*s1 == '_'))
while (c_isalnum (*s1) || (*s1 == '_'))
s1++;
s2 = s1;
@@ -925,7 +924,7 @@ parse_method (char *method, char *type, char **theclass,
s2++;
s2 = skip_spaces (s2);
ncategory = s2;
while (isalnum (*s2) || (*s2 == '_'))
while (c_isalnum (*s2) || (*s2 == '_'))
s2++;
*s2++ = '\0';
}
@@ -938,9 +937,9 @@ parse_method (char *method, char *type, char **theclass,
for (;;)
{
if (isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
if (c_isalnum (*s2) || (*s2 == '_') || (*s2 == ':'))
*s1++ = *s2;
else if (isspace (*s2))
else if (c_isspace (*s2))
;
else if (*s2 == ']')
break;

View File

@@ -43,7 +43,6 @@
Probably also lots of other problems, less well defined PM. */
%{
#include <ctype.h>
#include "expression.h"
#include "value.h"
#include "parser-defs.h"
@@ -817,13 +816,13 @@ parse_number (struct parser_state *par_state,
{
/* Handle suffixes: 'f' for float, 'l' for long double.
FIXME: This appears to be an extension -- do we want this? */
if (len >= 1 && tolower (p[len - 1]) == 'f')
if (len >= 1 && c_tolower (p[len - 1]) == 'f')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_float;
len--;
}
else if (len >= 1 && tolower (p[len - 1]) == 'l')
else if (len >= 1 && c_tolower (p[len - 1]) == 'l')
{
putithere->typed_val_float.type
= parse_type (par_state)->builtin_long_double;
@@ -1089,9 +1088,9 @@ yylex (void)
if (explen > 2)
for (const auto &token : tokentab3)
if (strncasecmp (tokstart, token.oper, 3) == 0
&& (!isalpha (token.oper[0]) || explen == 3
|| (!isalpha (tokstart[3])
&& !isdigit (tokstart[3]) && tokstart[3] != '_')))
&& (!c_isalpha (token.oper[0]) || explen == 3
|| (!c_isalpha (tokstart[3])
&& !c_isdigit (tokstart[3]) && tokstart[3] != '_')))
{
pstate->lexptr += 3;
yylval.opcode = token.opcode;
@@ -1102,9 +1101,9 @@ yylex (void)
if (explen > 1)
for (const auto &token : tokentab2)
if (strncasecmp (tokstart, token.oper, 2) == 0
&& (!isalpha (token.oper[0]) || explen == 2
|| (!isalpha (tokstart[2])
&& !isdigit (tokstart[2]) && tokstart[2] != '_')))
&& (!c_isalpha (token.oper[0]) || explen == 2
|| (!c_isalpha (tokstart[2])
&& !c_isdigit (tokstart[2]) && tokstart[2] != '_')))
{
pstate->lexptr += 2;
yylval.opcode = token.opcode;

View File

@@ -30,7 +30,6 @@
#include "p-lang.h"
#include "valprint.h"
#include "value.h"
#include <ctype.h>
#include "c-lang.h"
#include "gdbarch.h"
#include "cli/cli-style.h"

View File

@@ -30,7 +30,6 @@
#include "p-lang.h"
#include "typeprint.h"
#include "gdb-demangle.h"
#include <ctype.h>
#include "cli/cli-style.h"
/* See language.h. */
@@ -138,13 +137,13 @@ pascal_language::type_print_method_args (const char *physname,
{
gdb_puts (" (", stream);
/* We must demangle this. */
while (isdigit (physname[0]))
while (c_isdigit (physname[0]))
{
int len = 0;
int i, j;
char *argname;
while (isdigit (physname[len]))
while (c_isdigit (physname[len]))
{
len++;
}

View File

@@ -29,7 +29,6 @@
during the process of parsing; the lower levels of the tree always
come first in the result. */
#include <ctype.h>
#include "arch-utils.h"
#include "symtab.h"
#include "gdbtypes.h"

View File

@@ -61,7 +61,6 @@
#include "cli/cli-utils.h"
#include "parser-defs.h"
#include "user-regs.h"
#include <ctype.h>
#include "elf-bfd.h"
#include "producer.h"
#include "target-float.h"
@@ -1712,10 +1711,10 @@ static int
ppc_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return (*s == 'i' /* Literal number. */
|| (isdigit (*s) && s[1] == '('
&& isdigit (s[2])) /* Displacement. */
|| (*s == '(' && isdigit (s[1])) /* Register indirection. */
|| isdigit (*s)); /* Register value. */
|| (c_isdigit (*s) && s[1] == '('
&& c_isdigit (s[2])) /* Displacement. */
|| (*s == '(' && c_isdigit (s[1])) /* Register indirection. */
|| c_isdigit (*s)); /* Register value. */
}
/* Implementation of `gdbarch_stap_parse_special_token', as defined in
@@ -1725,7 +1724,7 @@ static expr::operation_up
ppc_stap_parse_special_token (struct gdbarch *gdbarch,
struct stap_parse_info *p)
{
if (isdigit (*p->arg))
if (c_isdigit (*p->arg))
{
/* This temporary pointer is needed because we have to do a lookahead.
We could be dealing with a register displacement, and in such case
@@ -1734,7 +1733,7 @@ ppc_stap_parse_special_token (struct gdbarch *gdbarch,
char *regname;
int len;
while (isdigit (*s))
while (c_isdigit (*s))
++s;
if (*s == '(')

View File

@@ -33,7 +33,6 @@
#include "ax.h"
#include "ax-gdb.h"
#include "location.h"
#include <ctype.h>
#include <algorithm>
#include <optional>
@@ -826,7 +825,7 @@ probe_is_linespec_by_keyword (const char **linespecp, const char *const *keyword
const char *keyword = *csp;
size_t len = strlen (keyword);
if (strncmp (s, keyword, len) == 0 && isspace (s[len]))
if (strncmp (s, keyword, len) == 0 && c_isspace (s[len]))
{
*linespecp += len + 1;
return 1;

View File

@@ -38,7 +38,6 @@
#include <sys/syscall.h>
#include "gdbsupport/gdb_wait.h"
#include <signal.h>
#include <ctype.h>
#include "gdb_bfd.h"
#include "auxv.h"
#include "procfs.h"
@@ -3304,7 +3303,7 @@ procfs_target::info_proc (const char *args, enum info_proc_what what)
gdb_argv built_argv (args);
for (char *arg : built_argv)
{
if (isdigit (arg[0]))
if (c_isdigit (arg[0]))
{
pid = strtoul (arg, &tmp, 10);
if (*tmp == '/')
@@ -3415,7 +3414,7 @@ proc_trace_syscalls (const char *args, int from_tty, int entry_or_exit, int mode
error_no_arg (_("system call to trace"));
pi = find_procinfo_or_die (inferior_ptid.pid (), 0);
if (isdigit (args[0]))
if (c_isdigit (args[0]))
{
const int syscallnum = atoi (args);

View File

@@ -66,9 +66,9 @@ producer_is_gcc (const char *producer, int *major, int *minor)
"GNU Fortran 4.8.2 20140120 (Red Hat 4.8.2-16) -mtune=generic ..."
"GNU C++14 5.0.0 20150123 (experimental)"
*/
while (*cs && !isspace (*cs))
while (*cs && !c_isspace (*cs))
cs++;
if (*cs && isspace (*cs))
if (*cs && c_isspace (*cs))
cs++;
if (sscanf (cs, "%d.%d", major, minor) == 2)
return 1;

View File

@@ -218,11 +218,11 @@ py_object_to_mi_key (PyObject *key_obj)
{
gdb_assert (name != nullptr);
if (*name == '\0' || !isalpha (*name))
if (*name == '\0' || !c_isalpha (*name))
return false;
for (; *name != '\0'; ++name)
if (!isalnum (*name) && *name != '_' && *name != '-')
if (!c_isalnum (*name) && *name != '_' && *name != '-')
return false;
return true;
@@ -363,7 +363,7 @@ gdbpy_notify_mi (PyObject *self, PyObject *args, PyObject *kwargs)
}
for (int i = 0; i < name_len; i++)
{
if (!isalnum (name[i]) && name[i] != '-')
if (!c_isalnum (name[i]) && name[i] != '-')
{
PyErr_Format
(PyExc_ValueError,

View File

@@ -350,7 +350,7 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
PyErr_SetString (PyExc_ValueError, _("MI command name is empty."));
return -1;
}
else if ((name_len < 2) || (name[0] != '-') || !isalnum (name[1]))
else if ((name_len < 2) || (name[0] != '-') || !c_isalnum (name[1]))
{
PyErr_SetString (PyExc_ValueError,
_("MI command name does not start with '-'"
@@ -361,7 +361,7 @@ micmdpy_init (PyObject *self, PyObject *args, PyObject *kwargs)
{
for (int i = 2; i < name_len; i++)
{
if (!isalnum (name[i]) && name[i] != '-')
if (!c_isalnum (name[i]) && name[i] != '-')
{
PyErr_Format
(PyExc_ValueError,

View File

@@ -556,7 +556,7 @@ objfpy_build_id_ok (const char *string)
return 0;
for (i = 0; i < n; ++i)
{
if (!isxdigit (string[i]))
if (!c_isxdigit (string[i]))
return 0;
}
return 1;

View File

@@ -31,7 +31,6 @@
#include "python.h"
#include "extension-priv.h"
#include "cli/cli-utils.h"
#include <ctype.h>
#include "location.h"
#include "run-on-main-thread.h"
#include "observable.h"

View File

@@ -28,7 +28,6 @@
#include "interps.h"
#include "top.h"
#include <ctype.h>
/* This is the debug switch for process record. */
unsigned int record_debug = 0;
@@ -423,7 +422,7 @@ get_insn_number (const char **arg)
begin = *arg;
pos = skip_spaces (begin);
if (!isdigit (*pos))
if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
number = strtoulst (pos, &end, 10);
@@ -443,7 +442,7 @@ get_context_size (const char **arg)
pos = skip_spaces (*arg);
if (!isdigit (*pos))
if (!c_isdigit (*pos))
error (_("Expected positive number, got: %s."), pos);
long result = strtol (pos, &end, 10);
@@ -483,7 +482,7 @@ get_insn_history_modifiers (const char **arg)
for (; *args; ++args)
{
if (isspace (*args))
if (c_isspace (*args))
break;
if (*args == '/')
@@ -627,7 +626,7 @@ get_call_history_modifiers (const char **arg)
for (; *args; ++args)
{
if (isspace (*args))
if (c_isspace (*args))
break;
if (*args == '/')

View File

@@ -25,7 +25,6 @@
#include "inferior.h"
#include "infrun.h"
#include "value.h"
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
#include <setjmp.h>

View File

@@ -19,7 +19,6 @@
/* See the GDB User Guide for details of the GDB remote protocol. */
#include <ctype.h>
#include <fcntl.h>
#include "exceptions.h"
#include "gdbsupport/common-inferior.h"
@@ -2559,7 +2558,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])
&& c_isxdigit (buf[1]) && c_isxdigit (buf[2])
&& buf[3] == '\0')
/* "Enn" - definitely an error. */
return packet_result::make_numeric_error (buf + 1);
@@ -11950,7 +11949,7 @@ remote_target::xfer_partial (enum target_object object,
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 (c_isprint (annex[i]) && annex[i] != '$' && annex[i] != '#');
*p2++ = annex[i];
i++;
}
@@ -12200,7 +12199,7 @@ private:
for (int i = 0; i < buf.size (); ++i)
{
gdb_byte c = buf[i];
if (isprint (c))
if (c_isprint (c))
gdb_putc (c, &stb);
else
gdb_printf (&stb, "\\x%02x", (unsigned char) c);

View File

@@ -18,7 +18,6 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "block.h"
#include "c-lang.h"
@@ -1788,7 +1787,7 @@ rust_language::emitchar (int ch, struct type *chtype,
gdb_puts ("\\t", stream);
else if (ch == '\0')
gdb_puts ("\\0", stream);
else if (ch >= 32 && ch <= 127 && isprint (ch))
else if (ch >= 32 && ch <= 127 && c_isprint (ch))
gdb_putc (ch, stream);
else if (ch <= 255)
gdb_printf (stream, "\\x%02x", ch);

View File

@@ -516,7 +516,7 @@ s12z_print_ccw_info (struct gdbarch *gdbarch,
gdb_putc (ccw_bits[b], file);
}
else
gdb_putc (tolower (ccw_bits[b]), file);
gdb_putc (c_tolower (ccw_bits[b]), file);
}
gdb_putc ('\n', file);
}

View File

@@ -7057,10 +7057,10 @@ s390_gnu_triplet_regexp (struct gdbarch *gdbarch)
static int
s390_stap_is_single_operand (struct gdbarch *gdbarch, const char *s)
{
return ((isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
return ((c_isdigit (*s) && s[1] == '(' && s[2] == '%') /* Displacement
or indirection. */
|| *s == '%' /* Register access. */
|| isdigit (*s)); /* Literal number. */
|| c_isdigit (*s)); /* Literal number. */
}
/* gdbarch init. */

View File

@@ -17,7 +17,6 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
#include "serial.h"
#include "cli/cli-cmds.h"
#include "cli/cli-utils.h"
@@ -116,7 +115,7 @@ serial_logchar (struct ui_file *stream, int ch_type, int ch, int timeout)
break;
default:
gdb_printf (stream,
isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
c_isprint (ch) ? "%c" : "\\x%02x", ch & 0xFF);
break;
}
}

View File

@@ -511,7 +511,7 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
protocol_end += protocol_delim.length ();
std::transform (protocol.begin (), protocol.end (), protocol.begin (),
[] (unsigned char c) { return std::tolower (c); });
[] (unsigned char c) { return c_tolower (c); });
std::string_view path;
size_t path_end = uri.find_first_of ("#?", protocol_end);
@@ -526,8 +526,8 @@ rocm_bfd_iovec_open (bfd *abfd, inferior *inferior)
for (size_t i = 0; i < path.length (); ++i)
if (path[i] == '%'
&& i < path.length () - 2
&& std::isxdigit (path[i + 1])
&& std::isxdigit (path[i + 2]))
&& c_isxdigit (path[i + 1])
&& c_isxdigit (path[i + 2]))
{
std::string_view hex_digits = path.substr (i + 1, 2);
decoded_path += std::stoi (std::string (hex_digits), 0, 16);

View File

@@ -46,7 +46,6 @@
#include "c-lang.h"
#include "cp-abi.h"
#include "cp-support.h"
#include <ctype.h>
#include "block.h"
#include "filenames.h"
@@ -3067,7 +3066,7 @@ process_reference (const char **string)
p = *string + 1;
/* Read number as reference id. */
while (*p && isdigit (*p))
while (*p && c_isdigit (*p))
{
refnum = refnum * 10 + *p - '0';
p++;
@@ -3251,7 +3250,7 @@ define_symbol (CORE_ADDR valu, const char *string, int desc, int type,
deftypes we know how to handle is a local. */
if (!strchr ("cfFGpPrStTvVXCR", *p))
#else
if (isdigit (*p) || *p == '(' || *p == '-')
if (c_isdigit (*p) || *p == '(' || *p == '-')
#endif
deftype = 'l';
else
@@ -4340,7 +4339,7 @@ again:
break;
case '@':
if (isdigit (**pp) || **pp == '(' || **pp == '-')
if (c_isdigit (**pp) || **pp == '(' || **pp == '-')
{ /* Member (class & variable) type */
/* FIXME -- we should be doing smash_to_XXX types here. */

View File

@@ -3064,7 +3064,7 @@ frame_apply_level_cmd_completer (struct cmd_list_element *ignore,
/* Check if we're past a valid LEVEL already. */
if (levels.finished ()
&& cmd > text && !isspace (cmd[-1]))
&& cmd > text && !c_isspace (cmd[-1]))
return;
/* We're past LEVELs, advance word point. */
@@ -3098,7 +3098,7 @@ frame_apply_cmd_completer (struct cmd_list_element *ignore,
return;
/* Check if we're past a valid COUNT already. */
if (cmd > text && !isspace (cmd[-1]))
if (cmd > text && !c_isspace (cmd[-1]))
return;
/* We're past COUNT, advance word point. */

View File

@@ -39,7 +39,6 @@
#include "expop.h"
#include "gdbsupport/unordered_map.h"
#include <ctype.h>
/* The name of the SystemTap section where we will find information about
the probes. */
@@ -575,14 +574,14 @@ stap_is_integer_prefix (struct gdbarch *gdbarch, const char *s,
if (r != NULL)
*r = "";
return isdigit (*s) > 0;
return c_isdigit (*s) > 0;
}
for (p = t; *p != NULL; ++p)
{
size_t len = strlen (*p);
if ((len == 0 && isdigit (*s))
if ((len == 0 && c_isdigit (*s))
|| (len > 0 && strncasecmp (s, *p, len) == 0))
{
/* Integers may or may not have a prefix. The "len == 0"
@@ -732,7 +731,7 @@ stap_parse_register_operand (struct stap_parse_info *p)
struct type *long_type = builtin_type (gdbarch)->builtin_long;
operation_up disp_op;
if (isdigit (*p->arg))
if (c_isdigit (*p->arg))
{
/* The value of the displacement. */
long displacement;
@@ -767,14 +766,14 @@ stap_parse_register_operand (struct stap_parse_info *p)
start = p->arg;
/* We assume the register name is composed by letters and numbers. */
while (isalnum (*p->arg))
while (c_isalnum (*p->arg))
++p->arg;
std::string regname (start, p->arg - start);
/* We only add the GDB's register prefix/suffix if we are dealing with
a numeric register. */
if (isdigit (*start))
if (c_isdigit (*start))
{
if (gdb_reg_prefix != NULL)
regname = gdb_reg_prefix + regname;
@@ -921,7 +920,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
if (p->inside_paren_p)
tmp = skip_spaces (tmp);
while (isdigit (*tmp))
while (c_isdigit (*tmp))
{
/* We skip the digit here because we are only interested in
knowing what kind of unary operation this is. The digit
@@ -959,7 +958,7 @@ stap_parse_single_operand (struct stap_parse_info *p)
(std::move (result)));
}
}
else if (isdigit (*p->arg))
else if (c_isdigit (*p->arg))
{
/* A temporary variable, needed for lookahead. */
const char *tmp = p->arg;
@@ -1042,7 +1041,7 @@ stap_parse_argument_conditionally (struct stap_parse_info *p)
expr::operation_up result;
if (*p->arg == '-' || *p->arg == '~' || *p->arg == '+' || *p->arg == '!'
|| isdigit (*p->arg)
|| c_isdigit (*p->arg)
|| gdbarch_stap_is_single_operand (p->gdbarch, p->arg))
result = stap_parse_single_operand (p);
else if (*p->arg == '(')
@@ -1111,7 +1110,7 @@ stap_parse_argument_1 (struct stap_parse_info *p,
This loop shall continue until we run out of characters in the input,
or until we find a close-parenthesis, which means that we've reached
the end of a sub-expression. */
while (*p->arg != '\0' && *p->arg != ')' && !isspace (*p->arg))
while (*p->arg != '\0' && *p->arg != ')' && !c_isspace (*p->arg))
{
const char *tmp_exp_buf;
enum exp_opcode opcode;
@@ -1270,8 +1269,8 @@ stap_probe::parse_arguments (struct gdbarch *gdbarch)
Where `N' can be [+,-][1,2,4,8]. This is not mandatory, so
we check it here. If we don't find it, go to the next
state. */
if ((cur[0] == '-' && isdigit (cur[1]) && cur[2] == '@')
|| (isdigit (cur[0]) && cur[1] == '@'))
if ((cur[0] == '-' && c_isdigit (cur[1]) && cur[2] == '@')
|| (c_isdigit (cur[0]) && cur[1] == '@'))
{
if (*cur == '-')
{

View File

@@ -58,7 +58,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ctype.h>
#include <chrono>
#include <algorithm>
@@ -2748,7 +2747,7 @@ set_ext_lang_command (const char *args,
error (_("'%s': Filename extension must begin with '.'"), ext_args.c_str ());
/* Find end of first arg. */
while (*end != '\0' && !isspace (*end))
while (*end != '\0' && !c_isspace (*end))
end++;
if (*end == '\0')

View File

@@ -56,7 +56,6 @@
#include <sys/types.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <ctype.h>
#include "cp-abi.h"
#include "cp-support.h"
#include "observable.h"
@@ -4332,7 +4331,7 @@ operator_chars (const char *p, const char **end)
/* Don't get faked out by `operator' being part of a longer
identifier. */
if (isalpha (*p) || *p == '_' || *p == '$' || *p == '\0')
if (c_isalpha (*p) || *p == '_' || *p == '$' || *p == '\0')
return *end;
/* Allow some whitespace between `operator' and the operator symbol. */
@@ -4341,11 +4340,11 @@ operator_chars (const char *p, const char **end)
/* Recognize 'operator TYPENAME'. */
if (isalpha (*p) || *p == '_' || *p == '$')
if (c_isalpha (*p) || *p == '_' || *p == '$')
{
const char *q = p + 1;
while (isalnum (*q) || *q == '_' || *q == '$')
while (c_isalnum (*q) || *q == '_' || *q == '$')
q++;
*end = q;
return p;
@@ -5119,7 +5118,7 @@ global_symbol_searcher::search () const
int fix = -1; /* -1 means ok; otherwise number of
spaces needed. */
if (isalpha (*opname) || *opname == '_' || *opname == '$')
if (c_isalpha (*opname) || *opname == '_' || *opname == '$')
{
/* There should 1 space between 'operator' and 'TYPENAME'. */
if (opname[-1] != ' ' || opname[-2] == ' ')
@@ -5601,7 +5600,7 @@ rbreak_command (const char *regexp, int from_tty)
if (colon && *(colon + 1) != ':')
{
int colon_index = colon - regexp;
while (colon_index > 0 && isspace (regexp[colon_index - 1]))
while (colon_index > 0 && c_isspace (regexp[colon_index - 1]))
--colon_index;
file_name = make_unique_xstrndup (regexp, colon_index);
@@ -5853,7 +5852,7 @@ language_search_unquoted_string (const char *text, const char *p)
{
for (; p > text; --p)
{
if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
if (c_isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0')
continue;
else
{
@@ -5873,7 +5872,7 @@ language_search_unquoted_string (const char *text, const char *p)
Unfortunately we have to find it now to decide. */
while (t > text)
if (isalnum (t[-1]) || t[-1] == '_' ||
if (c_isalnum (t[-1]) || t[-1] == '_' ||
t[-1] == ' ' || t[-1] == ':' ||
t[-1] == '(' || t[-1] == ')')
--t;
@@ -6081,7 +6080,7 @@ default_collect_symbol_completion_matches_break_on
which are in symbols. */
while (p > text)
{
if (isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0'
if (c_isalnum (p[-1]) || p[-1] == '_' || p[-1] == '\0'
|| p[-1] == ':' || strchr (break_on, p[-1]) != NULL)
--p;
else

View File

@@ -33,7 +33,6 @@
#include "regcache.h"
#include "btrace.h"
#include <ctype.h>
#include <sys/types.h>
#include <signal.h>
#include "ui-out.h"
@@ -1808,7 +1807,7 @@ thread_apply_command_completer (cmd_list_element *ignore,
/* Check if we're past a valid thread ID list already. */
if (parser.finished ()
&& cmd > text && !isspace (cmd[-1]))
&& cmd > text && !c_isspace (cmd[-1]))
return;
/* We're past the thread ID list, advance word point. */
@@ -1871,7 +1870,7 @@ thread_apply_command (const char *tidlist, int from_tty)
if (*cmd == '\0')
error (_("Please specify a command following the thread ID list"));
if (tidlist == cmd || isdigit (cmd[0]))
if (tidlist == cmd || c_isdigit (cmd[0]))
invalid_thread_id_error (cmd);
scoped_restore_current_thread restore_thread;

View File

@@ -20,7 +20,6 @@
#include "tid-parse.h"
#include "inferior.h"
#include "gdbthread.h"
#include <ctype.h>
/* See tid-parse.h. */
@@ -184,7 +183,7 @@ tid_range_parser::finished () const
or we are not in a range and not in front of an integer, negative
integer, convenience var or negative convenience var. */
return (*m_cur_tok == '\0'
|| !(isdigit (*m_cur_tok)
|| !(c_isdigit (*m_cur_tok)
|| *m_cur_tok == '$'
|| *m_cur_tok == '*'));
case STATE_THREAD_RANGE:
@@ -261,7 +260,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
m_qualified = true;
p = dot + 1;
if (isspace (*p))
if (c_isspace (*p))
return false;
}
else
@@ -272,7 +271,7 @@ tid_range_parser::get_tid_or_range (int *inf_num,
}
m_range_parser.init (p);
if (p[0] == '*' && (p[1] == '\0' || isspace (p[1])))
if (p[0] == '*' && (p[1] == '\0' || c_isspace (p[1])))
{
/* Setup the number range parser to return numbers in the
whole [1,INT_MAX] range. */

View File

@@ -69,7 +69,6 @@
#include "event-top.h"
#include <sys/stat.h>
#include <ctype.h>
#include "ui-out.h"
#include "cli-out.h"
#include "tracepoint.h"

View File

@@ -28,7 +28,6 @@
#include "inferior.h"
#include "gdbthread.h"
#include "tracefile.h"
#include <ctype.h>
#include <algorithm>
#include "gdbsupport/filestuff.h"
#include "gdbarch.h"

View File

@@ -308,12 +308,12 @@ validate_trace_state_variable_name (const char *name)
/* All digits in the name is reserved for value history
references. */
for (p = name; isdigit (*p); p++)
for (p = name; c_isdigit (*p); p++)
;
if (*p == '\0')
error (_("$%s is not a valid trace state variable name"), name);
for (p = name; isalnum (*p) || *p == '_'; p++)
for (p = name; c_isalnum (*p) || *p == '_'; p++)
;
if (*p != '\0')
error (_("$%s is not a valid trace state variable name"), name);
@@ -339,7 +339,7 @@ trace_variable_command (const char *args, int from_tty)
error (_("Name of trace variable should start with '$'"));
name_start = p;
while (isalnum (*p) || *p == '_')
while (c_isalnum (*p) || *p == '_')
p++;
std::string name (name_start, p - name_start);

View File

@@ -45,7 +45,6 @@
#include "tui/tui-win.h"
#include "gdb_curses.h"
#include <ctype.h>
#include "readline/readline.h"
#include <signal.h>
#include <string_view>
@@ -1041,7 +1040,7 @@ parse_scrolling_args (const char *arg,
/* Process the number of lines to scroll. */
std::string copy = arg;
buf_ptr = &copy[0];
if (isdigit (*buf_ptr))
if (c_isdigit (*buf_ptr))
{
char *num_str;

View File

@@ -31,7 +31,6 @@
#include "cp-abi.h"
#include "typeprint.h"
#include "valprint.h"
#include <ctype.h>
#include "cli/cli-utils.h"
#include "extension.h"
#include "completer.h"
@@ -367,7 +366,7 @@ whatis_exp (const char *exp, int show)
{
int seen_one = 0;
for (++exp; *exp && !isspace (*exp); ++exp)
for (++exp; *exp && !c_isspace (*exp); ++exp)
{
switch (*exp)
{
@@ -413,7 +412,7 @@ whatis_exp (const char *exp, int show)
if (!*exp && !seen_one)
error (_("flag expected"));
if (!isspace (*exp))
if (!c_isspace (*exp))
error (_("expected space after format"));
exp = skip_spaces (exp);
}

Some files were not shown because too many files have changed in this diff Show More