]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gas/obj-*.c: use is_whitespace()
authorJan Beulich <jbeulich@suse.com>
Mon, 3 Feb 2025 10:55:23 +0000 (11:55 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 3 Feb 2025 10:55:23 +0000 (11:55 +0100)
... for consistency of recognition of what is deemed whitespace.

In obj_elf_section_name() also generalize end-of-statement recognition
at the same time. Conversely drop the unused SKIP_SEMI_COLON() for COFF.

gas/config/obj-coff.c
gas/config/obj-elf.c
gas/config/obj-macho.c
gas/config/obj-som.c

index 2a393fe5e4e14525fe19526e12f0b3d7d4cd1fae..941e80d3c29f0194703225b6dd76f8fbd8f774f2 100644 (file)
@@ -567,9 +567,7 @@ obj_coff_ident (int ignore ATTRIBUTE_UNUSED)
    a C_EFCN. And a second reason is that the code is more clear this
    way. (at least I think it is :-).  */
 
-#define SKIP_SEMI_COLON()      while (*input_line_pointer++ != ';')
-#define SKIP_WHITESPACES()     while (*input_line_pointer == ' ' || \
-                                      *input_line_pointer == '\t')  \
+#define SKIP_WHITESPACES()     while (is_whitespace (*input_line_pointer)) \
                                   input_line_pointer++;
 
 static void
index b3b2025938be70bb8087a28b727b580f83c39790..0eb809cc15ea8a16a8e22d726151e186d24f4ee6 100644 (file)
@@ -1089,7 +1089,7 @@ obj_elf_section_name (void)
     {
       char *end = input_line_pointer;
 
-      while (0 == strchr ("\n\t,; ", *end))
+      while (!is_whitespace (*end) && !is_end_of_stmt (*end) && *end != ',')
        end++;
       if (end == input_line_pointer)
        {
@@ -1981,8 +1981,8 @@ obj_elf_get_vtable_inherit (void)
     ++input_line_pointer;
 
   if (input_line_pointer[0] == '0'
-      && (input_line_pointer[1] == '\0'
-         || ISSPACE (input_line_pointer[1])))
+      && (is_end_of_stmt (input_line_pointer[1])
+         || is_whitespace (input_line_pointer[1])))
     {
       psym = section_symbol (absolute_section);
       ++input_line_pointer;
@@ -2056,7 +2056,7 @@ obj_elf_vtable_entry (int ignore ATTRIBUTE_UNUSED)
   (void) obj_elf_get_vtable_entry ();
 }
 
-#define skip_whitespace(str)  do { if (*(str) == ' ') ++(str); } while (0)
+#define skip_whitespace(str)  do { if (is_whitespace (*(str))) ++(str); } while (0)
 
 static inline int
 skip_past_char (char ** str, char c)
index 205057273ee15a6827d8e0412645f3958b2df5e7..249791f90819e139e5d2764b1b98c2b3db76960e 100644 (file)
@@ -111,7 +111,7 @@ collect_16char_name (char *dest, const char *msg, int require_comma)
   {
       int len = input_line_pointer - namstart; /* could be zero.  */
       /* lose any trailing space.  */
-      while (len > 0 && namstart[len-1] == ' ')
+      while (len > 0 && is_whitespace (namstart[len-1]))
         len--;
       if (len > 16)
         {
@@ -330,7 +330,7 @@ obj_mach_o_section (int ignore ATTRIBUTE_UNUSED)
 
       len = input_line_pointer - p;
       /* strip trailing spaces.  */
-      while (len > 0 && p[len-1] == ' ')
+      while (len > 0 && is_whitespace (p[len - 1]))
        len--;
       tmpc = p[len];
 
@@ -369,7 +369,7 @@ obj_mach_o_section (int ignore ATTRIBUTE_UNUSED)
 
              len = input_line_pointer - p;
              /* strip trailing spaces.  */
-             while (len > 0 && p[len-1] == ' ')
+             while (len > 0 && is_whitespace (p[len - 1]))
                len--;
              tmpc = p[len];
 
index 611b1e744d582849fb4c945121d5a8bfdae97451..0d8108f4e04776ec0f94d939711eece1efcf9605 100644 (file)
@@ -79,7 +79,7 @@ obj_som_compiler (int unused ATTRIBUTE_UNUSED)
      quote.  */
   filename = buf + 1;
   p = filename;
-  while (*p != ' ' && *p != '\000')
+  while (!is_whitespace (*p) && *p != '\000')
     p++;
   if (*p == '\000')
     {
@@ -89,7 +89,7 @@ obj_som_compiler (int unused ATTRIBUTE_UNUSED)
   *p = '\000';
 
   language_name = ++p;
-  while (*p != ' ' && *p != '\000')
+  while (!is_whitespace (*p) && *p != '\000')
     p++;
   if (*p == '\000')
     {