From: Jan Beulich Date: Mon, 3 Feb 2025 10:55:23 +0000 (+0100) Subject: gas/obj-*.c: use is_whitespace() X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4f6f094446017d388583ece216beb3a5d0173f5f;p=thirdparty%2Fbinutils-gdb.git gas/obj-*.c: use is_whitespace() ... 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. --- diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 2a393fe5e4e..941e80d3c29 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -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 diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index b3b2025938b..0eb809cc15e 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -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) diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 205057273ee..249791f9081 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -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]; diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index 611b1e744d5..0d8108f4e04 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -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') {