]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Use gnulib c-ctype module in gdb
authorTom Tromey <tromey@adacore.com>
Mon, 4 Aug 2025 16:39:02 +0000 (10:39 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 9 Sep 2025 17:59:04 +0000 (11:59 -0600)
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>
112 files changed:
gdb/aarch64-linux-tdep.c
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-lex.l
gdb/ada-typeprint.c
gdb/ada-valprint.c
gdb/arm-linux-tdep.c
gdb/arm-tdep.c
gdb/auto-load.c
gdb/break-catch-exec.c
gdb/break-catch-fork.c
gdb/break-catch-syscall.c
gdb/break-catch-throw.c
gdb/break-cond-parse.c
gdb/breakpoint.c
gdb/btrace.c
gdb/c-exp.y
gdb/c-lang.c
gdb/charset.c
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-dump.c
gdb/cli/cli-option.c
gdb/cli/cli-script.c
gdb/cli/cli-setshow.c
gdb/cli/cli-utils.c
gdb/coff-pe-read.c
gdb/coffread.c
gdb/d-exp.y
gdb/darwin-nat.c
gdb/dictionary.c
gdb/dwarf2/index-common.c
gdb/dwarf2/read.c
gdb/eval.c
gdb/exec.c
gdb/expprint.c
gdb/f-exp.y
gdb/fbsd-nat.c
gdb/findcmd.c
gdb/gdb_wchar.h
gdb/gnu-nat.c
gdb/gnu-v2-abi.c
gdb/go-exp.y
gdb/go-lang.c
gdb/go32-nat.c
gdb/guile/scm-cmd.c
gdb/i386-tdep.c
gdb/ia64-linux-tdep.c
gdb/infcmd.c
gdb/infrun.c
gdb/language.c
gdb/linespec.c
gdb/linux-fork.c
gdb/linux-nat.c
gdb/linux-tdep.c
gdb/linux-thread-db.c
gdb/location.c
gdb/main.c
gdb/maint.c
gdb/mi/mi-cmd-break.c
gdb/mi/mi-cmd-stack.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-main.c
gdb/mi/mi-parse.c
gdb/minsyms.c
gdb/nat/linux-osdata.c
gdb/netbsd-nat.c
gdb/objc-lang.c
gdb/p-exp.y
gdb/p-lang.c
gdb/p-typeprint.c
gdb/parse.c
gdb/ppc-linux-tdep.c
gdb/probe.c
gdb/procfs.c
gdb/producer.c
gdb/python/py-mi.c
gdb/python/py-micmd.c
gdb/python/py-objfile.c
gdb/python/python.c
gdb/record.c
gdb/remote-sim.c
gdb/remote.c
gdb/rust-lang.c
gdb/s12z-tdep.c
gdb/s390-tdep.c
gdb/serial.c
gdb/solib-rocm.c
gdb/stabsread.c
gdb/stack.c
gdb/stap-probe.c
gdb/symfile.c
gdb/symtab.c
gdb/thread.c
gdb/tid-parse.c
gdb/top.c
gdb/tracectf.c
gdb/tracepoint.c
gdb/tui/tui-win.c
gdb/typeprint.c
gdb/unittests/command-def-selftests.c
gdb/utils.c
gdb/valprint.c
gdb/value.c
gdb/windows-nat.c
gdb/xcoffread.c
gdbserver/gdbreplay.cc
gdbserver/remote-utils.cc
gdbserver/server.cc
gdbserver/thread-db.cc
gdbserver/tracepoint.cc
gdbsupport/pathstuff.cc

index 76bde85188bbcd44f726b02b9a97657b36c24d70..048be4f3532083f13138898cdb881f494dd2d904 100644 (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);
index 7ac103de61c3491ae4a464edd9495a7e0841fd0e..ed5694e2f1f5cfba29d06cb5011a722e065cf51c 100644 (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.  */
     }
index b7039fdddfe8142e58766d77c6e01541dda75db0..b403c5a366e9bcebd09f59b6a20953fc71a939d8 100644 (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] == '_')
index 0cfa0c8c551d084027a24b560202055968c558a7..eec80cfb207308f4543f2924f0e46ab2b8c7d0e3 100644 (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);
 }
index defd828934e6e1b5096738bb895871ab9ecd4139..5829a9b4ef365a64795e97e8bf892d4932779b5c 100644 (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)
index 7c6826e49e2039af8ef5e58c5f272266b2e3eba9..c198fa519f86066c22a8448df8ddb864f58ce51f 100644 (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, "\"\"");
index cc10679a51c8dddfaca694f0ad14d8362866985e..ff20ed88d466af54f3e92fbc507eefae35586a02 100644 (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
index a4bc0bd3e3de0d24d23f81e77b834d137ed69a2c..940d05f75e6dfed33b2f6034fd18a08ed7cbf880 100644 (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"
index 114a7d56448e00d0adcc424edebf95cd8cbc0bc8..8817bd12cb0fee636bc0d43d3d139100cc8954f9 100644 (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.  */
index 570018c53e3e7d26e140434b8e44a71a79eb0d60..9bfdb442f441e34e8991ba4857d64e22ebbbcfc1 100644 (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
index c8a63301f2b924f173299fc00e4dbf5775f389b7..535040c90f74ba88ddd68bd5d3f7c39bc2295b47 100644 (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
index 96f22a173fc9364210b6822789687619d36947c1..fad76e718d02225ac9a14112d09531c538071eaa 100644 (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;
index 6da38ebfd70639d55fc487c28e714cc4ad027f0f..1a45d7c7498c6c90890327d0e516ade31887110a 100644 (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
index 31b534371f1a846d2c5c8c799ee525ea80521dc7..b7713446e56f79846f66e6a65abf5a9a116ab371 100644 (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;
index 460934299a82e273dcf81acba63f05e36a84c421..5d87fb94aea7fd5b5bcce38e24e1be635cc0e89f 100644 (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,
index b23de887abef7fd950970c490d2430d296f6d78a..3d43261280fbea110bbd2e1d747d3118a0e6801d 100644 (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;
index cd5dc268a4c0d95fb79610ed3f3c2bed430e23b8..98be2da72342f59e55a205d474f7fe87150ae9dd 100644 (file)
@@ -35,7 +35,6 @@
 
 %{
 
-#include <ctype.h>
 #include "expression.h"
 #include "value.h"
 #include "parser-defs.h"
index 7fff11a76f75c71f569bf1583ed1c1cd9c09e48f..e8e66a6e19f6e449b576fad71b1ea8d5715b6952 100644 (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"
index 259362563b23675dce00d4147b927f26db34543c..fe725efcfd17f92aaec827dd4c9f3e24b1989940 100644 (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>
index a15a04a27fd50973052a30f410b717e9c91c1423..d3536547c337bff8a38f8a319fd341ddb27fdbcf 100644 (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);
 
index 48a34667c37ca708693a5d9f7af4734af8ccf4a9..2b30a6e04fb7b9ec732765ace102091f4a7ab511 100644 (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
index afbbea6cd5861469a0667869507a7a2904ac9999..3cdd9a334d3cc3c4af22944eeaa6390bfd28dac2 100644 (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"
index a30261e5c0fb4896686338872b4aa842d4d43d45..5da8c737c430e215518faad6abc07b1bdd580f5b 100644 (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);
index 3ea80a50f38798ffef10dad3d7f6a355b88ce471..048d3914ffd88f55fad149d7f6793efa923e9f17 100644 (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;
 
index 4d4695f9456d2968b87324b9cb59fed2cfe43368..8528ac52148bbf705f6a0d21ab1b1e563f144a05 100644 (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.  */
index 23706e00d3af23beb5903900c80695c798c480f9..d0ca594671d04e140978fc56411a24c27976049c 100644 (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);
index 0061007b6fd27168483d4b6a6004f76818263230..9255555231f85c61c9001a79eba69243f999e29e 100644 (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 ());
     }
index b69c06f381d58199c704f4941acc556a3bf311f3..44e761abe89acfc1ea80e2caaa92a0db790e1b35 100644 (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;
index f77b15e46f2d3202d367ca214ac9ae7ce6fbbf31..6b4fd048e6f1a9b456a79417b82d26ab677cfacb 100644 (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];
index 7acf63948597dcb63539721f5cda76a03476b62f..e73b5a1395bc22805d693f9f68398b300c791794 100644 (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>
index 17c9b448f592cf4ed5b8308c89d2ea8844d42c9e..e53331bed4575e0515f2967a66f737fbfa7971f0 100644 (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"
index c24c8fc6c27bb4cc02410c0b79a766b1cc42dd68..a314ce7b0e298762243c4eb88adb6f68e9f3ab7b 100644 (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;
 }
index 30a0141b65d01e6f280a57ffb0350b94aae7ed91..c76086fbc0496251cd5424d2b216a59bf500b776 100644 (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;
index 491125c74096a8c06e9c460a4a99518aec3a0824..498c0bffd1e2d7971090fdc0498b2338dcbc7d73 100644 (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"
index 0db5d9030bd164b8b33c50794fbf75a0159b480e..a904f5c53ad08a013ddc3d2180f6ddad12706155 100644 (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.  */
index c87be741a12ee2d92ae4a5ffcde298f3cc427f90..a32b7acc4b36a9ddd0e21131a84ce8aaa73b0c5b 100644 (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);
index afcdc4141cc8dec553cb7ba3a6e8866bf630a557..07fc54ca9a1c2226a76e5b5e04bdb30f50c9b1cc 100644 (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')
index 935b9479e6807b80a7df0e8359aa0bd90eb0116e..81bd6d98469b69e43ffd8bff8e10e62234008320 100644 (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."));
index 4e478779b6731e3d753e3cab36d5b9b5c0d62b7d..03c3fccad8675c220af16047341220d2f93c8abb 100644 (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;
            }
index 417d5bab739575bf427fffe55faa49ef97d21ea3..9db0d5e043a7c8b743fc1136418812410d3883db 100644 (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
 
index dd639fec8a91343033ea621f08c87a90c04b1a4a..33391ba35f2bc85629817002303884ac4fda2088 100644 (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\"."));
 
index 924678819a7f4bfd37af0cef37d35f95d6cbce3c..1fbc41d2c39cb4416714d89354d23dfc863c9f4b 100644 (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
index a61724285c4b299d1c9daefa555f8f532ee63e2e..5da8cefd64b0ce8d88c7b5fa25754d152cc11729 100644 (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];
index bad2ccfc35a67b27452d3e46941ba3ca4bdf9b52..23ffedb042ab3a170ac37c84b4ccf9bdbaa2b863 100644 (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)
        {
index 4d8e6c9fee0d36b02f2251fb77113d6abe275915..ab13b57411490e725965c3393ca8f9df558bcd1a 100644 (file)
 #include "cli/cli-utils.h"
 #include "inf-child.h"
 
-#include <ctype.h>
 #include <unistd.h>
 #include <sys/utsname.h>
 #include <io.h>
index 19fb742f7f166e2c130e956b32cd150b07410799..ef4c9d6b011e70788f828d5097b56055a284c553 100644 (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"
index f75745a3ecf69e62a0aee6b750434345429373c3..d3ad402addc140ef393e164f50b5af7b6cde742c 100644 (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;
index 6afffeea4e3bda9c39fd713e2bc9a890ead48d8a..8b4e1f95291bf1c4c1972ebca1acb412a83abf55 100644 (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. */
index a785ae37758660ff6457be90b8b048067cecfb1f..d20b6464eebf486bc73b0b22773955cbadf0b216 100644 (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;
 
index 3b5cff71cc2f70d956195429539c9c1a9c498078..289c503963cfa2203d04a36d253e36b475a43241 100644 (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;
index 212a236e2472c8b251e99f12586ed7b0f40dde8c..c070169e7b2f4d7a6d01920dfa2bff207c6a0309 100644 (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"
index e634bf22f3c7eea93d08994b2d83f23531273bbd..70e2af9441995af40b21d8edf87fc4caff17bc7e 100644 (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.  */
index 9e986d8d7ca90c81b52f4818d0478fff3f137311..0171259bea51e78917ab0e4e11c89e4aff15f8ac 100644 (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);
index c3c5ddf4e40be5cfa7f09f2f68f553228c25e715..87fb800e5440a98a259f16f014965159f4153eab 100644 (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"
index f07f9879614c847ef49929388f1ad732521066af..4b679c8759ed62a320d9223d9f77072f8b6d4ea3 100644 (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);
     }
 
index 8d49508d1ab822a4acaa3cba8a94749e0a33449a..82bfe0802234896ba0f0a6f914b74885895a9ff4 100644 (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"
index 378fafc60f7d28b043370196ba88cf8e231129bd..197c47bbe47e9f3da2916f00ee5c70093c33f484 100644 (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 ());
index eac708955806ea496c770d8980c34d5e9822edc3..e1ef537c3572c0554e768a45b6eaa4767c57340e 100644 (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);
index d76d957b6e66d2ab6e2f00c1047a33f7f8944103..8bc28562d1006af276643657749702939116cc3c 100644 (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"));
index e4cb2e7d335601a1357baae6c669b93fe89fc363..1cb8435451387246c714eaaba3c1ed8f12e4e047 100644 (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
            {
index fad058efb28502b34441f32c3607e8cecb264082..52ae11b39afbd501ea9afcadeb833d9bfcc9abcc 100644 (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"
index 9cbb85722b3d81d4c1096f1245d988c4f7818405..09d6107c11bf7e8eef72655c3c867ef6ab8bc460 100644 (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)
index 789e6fa4ad5b7c6d55736028b889ed1b85df776b..bcc32f9bfea912e69d1282d15fae724f4b9d83e0 100644 (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"
index 0af90cb711bf482ad526031f5f64a3846da7e0c8..58bdf4a4066bfc3590741fe16fc530bcee380469 100644 (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);
     }
index 765535cc32eba9e2b98bae594bda8f7343c983b2..c4a0fa873761497a11872a54257c841440f93bf5 100644 (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"
index b52a8ed5f363391850c88769cc3d71c0fe84bc91..0a309b863d3c483d5fad2300adf894b5844573a1 100644 (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
index 060134f7b201639d382592696cab5a977d06ade6..207e69cfdc55186f36ad7b00a9084238c5d1b21b 100644 (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."));
index 6bba8d33af97ac579c520310a266314418cca6da..492020df8dcff0b6375215aadd10c2f95fd6ebaa 100644 (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;
index 2b923ab44df628805dbb795a1822ba58888902dc..a68443a5b7f1cf20d4c96ede7e673ff8af1c5121 100644 (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;
index 3ded1524bde5330a7733e26d1874c6208d669eb5..1dc1a34663cbcf2d11f44f1ffbbbfb8d8bd6ea0d 100644 (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"
index 7994ccfc77dece2d5a1fc3dcc2be8465abfb63ba..8b5f2b548a5a8bbad9bab920b7a8c43c97310f8b 100644 (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++;
            }
index 6ad4e712a77025ea3821325b27c07043b758e24a..e24a0d01d54997eb4f5e55e6a28b162525d9f28e 100644 (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"
index 39566a48d291b6b8111a84359d763f1e6b043ffd..b5f8bbfd59eff2a51d8df5be1376400777838af3 100644 (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 == '(')
index 6679f39cc67c44b25e1e443f770e6e8518cdfbeb..c2b8270a476be3fb421782ddc939a2b239ac0fe5 100644 (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;
index a10574af629526f31e7ccfafbea6eddddafd6f63..ca7ecbbe190d5231e1ff761ffdbae3ac3c43ad26 100644 (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);
 
index 5d754faedb8a3c8b0da0ac2bc9129ac043feb511..71e1b92e95e7ece6b5f0825ad5b4a6a17eafdca7 100644 (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;
index 9b871d42c9266421649d5a1aab8e2dd51f350f9e..b2ab4e20e41d9d260c6fcc51a2a1bf2b73f07797 100644 (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,
index 72f427f24b2200cadd861f5f874bef2d58b6120c..07db0cca50d9f1c00529b10e948e12cf33f97eb8 100644 (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,
index 8f92642d488ceee95ba803bfc2e5cd8160a586d7..a9f5754cfa511c0509b366d6fb16c418bf631d48 100644 (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;
index 3b5d06944b2bf58c88561660ad406b8810b76269..740b196874286dded845788e91006a5031461314 100644 (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"
index 248cfaa481ab71f89d82e23f5e545cc4b6789671..de1a7a87a8e430d04adba20220004ab0947f6887 100644 (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 == '/')
index 425e50ddfc062e1387697d97b8a3c6cc928388db..a325ffa58989cc76caec5b58a480c8984c2cf441 100644 (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>
index 1d8d9b10339a96586a46a6172576a12ddd8f0d57..1eb4f7279cfe4948ec0a8c6e1c691cb51c0cae3c 100644 (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);
index 360555280c32a5327e5caa58a76177f22514a2f3..4626685e616544409ff814cc45bb065f4c331eb0 100644 (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);
index 28d56356661e62b22f14ceaf6f5ab8b17c172ed0..0d49f9888c9be28b74526822e44f07ca33ab6642 100644 (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);
 }
index c5fa24eb23141f1eff813f03ec93fd211e775588..0cef5f4645d09129c617cf2347b6f75a8672f9a8 100644 (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.  */
index d66c6379f3b6b1050eb159fbbdfb01c2b4f494fa..d047fdf5c75becfbd16257200db9a25debd031d2 100644 (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;
          }
     }
index c39d9d712a41862e39a7bd7ca88dfd55f79356d8..c3c2e44505e0b8b8b92fab0c32e85724a59647f4 100644 (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);
index 2d1411e9146c489ce852a4c16248f776abb11f42..733fc9e6ddc15731fc545ac4070fb814c1488acf 100644 (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.  */
 
index c0af030bd7443fb848f267dbad80a353e61a5a14..add1c547b5523f648d17ba9ce4a6646fb3883213 100644 (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.  */
index 3b692e292381f1638091631a6df0f7e3d42bfab3..6c15bce704c89df0631216907a365a9bfb9bb11a 100644 (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 == '-')
            {
index 8e4888fe0087b144b90f82bd00a7bb8269424ba9..15e9ed3bb6b26bd8ff4419e235255da6f1ef11c6 100644 (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')
index 245eab20cfeeae6b23cc2ec45e5b81e60f0f06f0..134160752003f4508a73b32b7d56cf110d35bec0 100644 (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
index 920d8dc07a8551a299b475526fa0ac60588b0c32..b6c19f9bfc1122863e571dc93bd1c9bbaffe001b 100644 (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;
index 4e45798b27b8bd2284c00ffa6eead42158c54168..9f79fba6077ab9594b1285c1a7996c1415d54dbb 100644 (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.  */
index b34f291f0e637dcdb79cfef6f866188cf41273da..f5b9fdc3034684b062803cfe74a607f9ebcbe041 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -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"
index 0f80d08e6d6c636a832df59d1bb872bc785a9166..c2231ff32d23fff66507a0b7946149d6f5818d0f 100644 (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"
index 58aad4430c739297db5c298461795bac37db48bd..879e4a6b33e34fecd0df46ed508ccdf2b28ac034 100644 (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);
 
index d4fbbf157f119632d1021fdf48e682239d6eeb9c..b411d074ffe196d1424ab9010723c14580a7538c 100644 (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;
 
index 8f2836a610d384d897aa86356a91be2b46fe9268..42fbf381c0b9087a2092d1cf431064817281902d 100644 (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);
        }
index 0a54d31fbc6358291f9972536d6c40e5137cfd7d..095b57f6e95cd900c522b2b8010e27c01c83e2e0 100644 (file)
@@ -72,7 +72,7 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
           "first line is not terminated with a '.' character");
 
       /* Checks the doc is not terminated with a new line.  */
-      if (isspace (c->doc[strlen (c->doc) - 1]))
+      if (c_isspace (c->doc[strlen (c->doc) - 1]))
        broken_doc_invariant
          (prefix, c->name,
           "has superfluous trailing whitespace");
@@ -87,7 +87,7 @@ check_doc (struct cmd_list_element *commandlist, const char *prefix)
          else
            {
              /* \n\n is ok, so we check that explicitly here.  */
-             if (isspace (nl[-1]) && nl[-1] != '\n')
+             if (c_isspace (nl[-1]) && nl[-1] != '\n')
                broken_doc_invariant (prefix, c->name,
                                      "has whitespace before a newline");
            }
index 5994ef9fb559e2bee01ed8dcc8f75e73b714be9b..57c739ee530b64c4e67c7025832738e387ac885e 100644 (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 "gdbsupport/gdb_wait.h"
 #include "gdbsupport/scoped_signal_handler.h"
 #include "event-top.h"
index 305faf73a56cf8bea41debf2bb4fcbbf86150545..b8c1c06ec87b82316f0f5014898fc42a1678c556 100644 (file)
@@ -34,7 +34,6 @@
 #include "gdbsupport/gdb_obstack.h"
 #include "charset.h"
 #include "typeprint.h"
-#include <ctype.h>
 #include <algorithm>
 #include "gdbsupport/byte-vector.h"
 #include "cli/cli-option.h"
index 82d9a86e372aea4a50d0b612996cf8ebecc39058..c78bb98cb7eb1f3e96e1e31bb594b12207c91efc 100644 (file)
@@ -35,7 +35,6 @@
 #include "valprint.h"
 #include "cli/cli-decode.h"
 #include "extension.h"
-#include <ctype.h>
 #include "tracepoint.h"
 #include "cp-abi.h"
 #include "user-regs.h"
@@ -3723,11 +3722,11 @@ value_from_history_ref (const char *h, const char **endp)
     len = 2;
 
   /* Find length of numeral string.  */
-  for (; isdigit (h[len]); len++)
+  for (; c_isdigit (h[len]); len++)
     ;
 
   /* Make sure numeral string is not part of an identifier.  */
-  if (h[len] == '_' || isalpha (h[len]))
+  if (h[len] == '_' || c_isalpha (h[len]))
     return NULL;
 
   /* Now collect the index value.  */
index c001d38fc5151a5a6123566013e96fcbc3c14b5c..f74ea0cc11b3c68214204002f0a2190a33ccb26f 100644 (file)
@@ -2426,7 +2426,7 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
   /* cmd.exe recognizes "&N" only immediately after the redirection symbol.  */
   if (*s != '&')
     {
-      while (isspace (*s))  /* skip whitespace before file name */
+      while (c_isspace (*s))  /* skip whitespace before file name */
        s++;
       *d++ = ' ';          /* separate file name with a single space */
     }
@@ -2453,7 +2453,7 @@ redir_set_redirection (const char *s, int *inp, int *out, int *err)
            s++;
          *d++ = *s++;
        }
-      else if (isspace (*s) && !quote)
+      else if (c_isspace (*s) && !quote)
        break;
       else
        *d++ = *s++;
@@ -2489,7 +2489,7 @@ redirect_inferior_handles (const char *cmd_orig, char *cmd,
   int quote = 0;
   bool retval = false;
 
-  while (isspace (*s))
+  while (c_isspace (*s))
     *d++ = *s++;
 
   while (*s)
index 6528cab633a0ecc1472efdab58729577f5eebbbb..d8b99a05911ad7c57b60528bcc758281b88badf5 100644 (file)
@@ -23,7 +23,6 @@
 
 #include <sys/types.h>
 #include <fcntl.h>
-#include <ctype.h>
 #ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
 #endif
index a5170317156bf4bd7e2283bbeaff54c091bc1b90..1c6c41c3459ce9d5d47753e1ff843edcbab616f1 100644 (file)
@@ -32,7 +32,6 @@
 #if HAVE_SIGNAL_H
 #include <signal.h>
 #endif
-#include <ctype.h>
 #if HAVE_FCNTL_H
 #include <fcntl.h>
 #endif
index 15f073dd6bece9225e03c4a0ab47b17f64ca3b72..760655994c51d7f989f40c555284deddb0e2dc81 100644 (file)
@@ -30,7 +30,6 @@
 #include "gdbsupport/netstuff.h"
 #include "gdbsupport/filestuff.h"
 #include "gdbsupport/gdb-sigmask.h"
-#include <ctype.h>
 #if HAVE_SYS_IOCTL_H
 #include <sys/ioctl.h>
 #endif
@@ -759,7 +758,7 @@ input_interrupt (int unused)
       else if (cc != 1 || c != '\003')
        {
          fprintf (stderr, "input_interrupt, count = %d c = %d ", cc, c);
-         if (isprint (c))
+         if (c_isprint (c))
            fprintf (stderr, "('%c')\n", c);
          else
            fprintf (stderr, "('\\x%02x')\n", c & 0xff);
@@ -1165,8 +1164,8 @@ prepare_resume_reply (char *buf, ptid_t ptid, const target_waitstatus &status)
               here is convert the buffer from a T packet to an S packet
               and the avoid adding any extra content by breaking out.  */
            gdb_assert (buf_start[0] == 'T');
-           gdb_assert (isxdigit (buf_start[1]));
-           gdb_assert (isxdigit (buf_start[2]));
+           gdb_assert (c_isxdigit (buf_start[1]));
+           gdb_assert (c_isxdigit (buf_start[2]));
            buf_start[0] = 'S';
            buf_start[3] = '\0';
            break;
index 669c76159ac7fe07deafd4fdb02b612f09ae6809..6dc805abd4d64a011b7ea9028247854a86503c5a 100644 (file)
@@ -22,7 +22,6 @@
 #include "tdesc.h"
 #include "gdbsupport/rsp-low.h"
 #include "gdbsupport/signals-state-save-restore.h"
-#include <ctype.h>
 #include <unistd.h>
 #if HAVE_SIGNAL_H
 #include <signal.h>
@@ -1427,7 +1426,7 @@ parse_debug_format_options (const char *arg, int is_monitor)
   debug_timestamp = 0;
 
   /* First remove leading spaces, for "monitor set debug-format".  */
-  while (isspace (*arg))
+  while (c_isspace (*arg))
     ++arg;
 
   std::vector<gdb::unique_xmalloc_ptr<char>> options
@@ -1473,8 +1472,8 @@ parse_debug_format_options (const char *arg, int is_monitor)
 struct debug_opt
 {
   /* NAME is the name of this debug option, this should be a simple string
-     containing no whitespace, starting with a letter from isalpha(), and
-     contain only isalnum() characters and '_' underscore and '-' hyphen.
+     containing no whitespace, starting with a letter from c_isalpha(), and
+     contain only c_isalnum() characters and '_' underscore and '-' hyphen.
 
      SETTER is a callback function used to set the debug variable.  This
      callback will be passed true to enable the debug setting, or false to
@@ -1483,7 +1482,7 @@ struct debug_opt
     : m_name (name),
       m_setter (setter)
   {
-    gdb_assert (isalpha (*name));
+    gdb_assert (c_isalpha (*name));
   }
 
   /* Called to enable or disable the debug setting.  */
index 20e1dccab18c4773746a5d74776df5b7350452bd..b964389e959dbec8b096a43eaf9474e41313fa14 100644 (file)
@@ -32,7 +32,6 @@
 #include <dlfcn.h>
 #endif
 #include <limits.h>
-#include <ctype.h>
 
 struct thread_db
 {
@@ -849,7 +848,7 @@ thread_db_handle_monitor_command (char *mon)
        free (libthread_db_search_path);
 
       /* Skip leading space (if any).  */
-      while (isspace (*cp))
+      while (c_isspace (*cp))
        ++cp;
 
       if (*cp == '\0')
index b308c821e8fbf08fe7cfd40f8f77a4439a22e717..e1044dca5585865b82eded5bfdcb9872c4177f16 100644 (file)
@@ -20,7 +20,6 @@
 #include "gdbthread.h"
 #include "gdbsupport/rsp-low.h"
 
-#include <ctype.h>
 #include <fcntl.h>
 #include <unistd.h>
 #include <chrono>
@@ -1867,7 +1866,7 @@ add_tracepoint_action (struct tracepoint *tpoint, const char *packet)
            trace_debug ("Want to collect registers");
            ++act;
            /* skip past hex digits of mask for now */
-           while (isxdigit(*act))
+           while (c_isxdigit(*act))
              ++act;
            break;
          }
index ce01c95304881caf3cd1c634c87b144264291d49..1866949d62daf34ad3745b617ff40b69667cc9c2 100644 (file)
@@ -106,7 +106,7 @@ gdb_realpath_keepfile (const char *filename)
 #ifdef HAVE_DOS_BASED_FILE_SYSTEM
   /* We need to be careful when filename is of the form 'd:foo', which
      is equivalent of d:./foo, which is totally different from d:/foo.  */
-  if (strlen (dir_name) == 2 && isalpha (dir_name[0]) && dir_name[1] == ':')
+  if (strlen (dir_name) == 2 && c_isalpha (dir_name[0]) && dir_name[1] == ':')
     {
       dir_name[2] = '.';
       dir_name[3] = '\000';