gas: drop SKIP_WHITESPACE_AFTER_NAME()

Exclusively all users should use restore_line_pointer() instead, at
which point SKIP_WHITESPACE() suffices as a check afterwards.
This commit is contained in:
Jan Beulich 2024-10-14 14:37:29 +02:00
parent a227513b8b
commit b03815327a
21 changed files with 85 additions and 98 deletions

View File

@ -1150,8 +1150,8 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED)
}
c = 0;
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
S_SET_WEAK (symbolP);
if (c == ',')
@ -1557,8 +1557,8 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (&section_name);
name = xmemdup0 (section_name, input_line_pointer - section_name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
exp = 0;
flags = SEC_NO_FLAGS;

View File

@ -344,8 +344,8 @@ get_sym_from_input_line_and_check (void)
c = get_symbol_name (& name);
sym = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
/* There is no symbol name if input_line_pointer has not moved. */
if (name == input_line_pointer)
@ -1937,9 +1937,9 @@ obj_elf_get_vtable_inherit (void)
bad = 1;
}
*input_line_pointer = c;
restore_line_pointer (c);
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
as_bad (_("expected comma after name in .vtable_inherit"));
@ -2353,8 +2353,8 @@ obj_elf_size (int ignore ATTRIBUTE_UNUSED)
symbolS *sym;
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
*p = 0;

View File

@ -471,7 +471,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (&name);
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
restore_line_pointer (c);
if (name == p)
{
@ -480,7 +480,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED)
goto done;
}
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
input_line_pointer++;
@ -1128,8 +1128,8 @@ obj_mach_o_sym_qual (int ntype)
c = get_symbol_name (&name);
symbolP = symbol_find_or_make (name);
obj_mach_o_set_symbol_qualifier (symbolP, ntype);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
c = *input_line_pointer;
if (c == ',')
{

View File

@ -308,8 +308,8 @@ obj_som_weak (int ignore ATTRIBUTE_UNUSED)
{
c = get_symbol_name (&name);
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
S_SET_WEAK (symbolP);
if (c == ',')
{

View File

@ -936,8 +936,8 @@ tokenize_arguments (char *str,
goto err_report;
}
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != '!')
{
if (r->require_seq)
@ -3499,9 +3499,9 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED)
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
restore_line_pointer (c);
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
/* Alpha OSF/1 compiler doesn't provide the comma, gcc does. */
if (*input_line_pointer == ',')
@ -3746,8 +3746,8 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED)
/* The .ent directive is sometimes followed by a number. Not sure
what it really means, but ignore it. */
*input_line_pointer = name_end;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (name_end);
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
{
input_line_pointer++;
@ -4316,11 +4316,11 @@ s_alpha_section (int secid)
SKIP_WHITESPACE ();
c = get_symbol_name (&beg);
*input_line_pointer = c;
restore_line_pointer (c);
vms_flags |= s_alpha_section_word (beg, input_line_pointer - beg);
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
}
while (*input_line_pointer++ == ',');
@ -4938,8 +4938,8 @@ s_alpha_proc (int is_static ATTRIBUTE_UNUSED)
c = get_symbol_name (&name);
p = input_line_pointer;
symbolP = symbol_find_or_make (name);
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
*p = 0;

View File

@ -1152,8 +1152,8 @@ parse_reloc_symbol (expressionS *resultP)
return;
}
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
/* Extra check for TLS: base. */
if (*input_line_pointer == '@')
{

View File

@ -234,8 +234,8 @@ s_proc (int end_p)
delim1 = get_symbol_name (&name);
name = xstrdup (name);
*input_line_pointer = delim1;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (delim1);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{

View File

@ -4199,24 +4199,23 @@ dot_unwabi (int dummy ATTRIBUTE_UNUSED)
static void
dot_personality (int dummy ATTRIBUTE_UNUSED)
{
char *name, *p, c;
char *name, c;
if (!in_procedure ("personality"))
return;
SKIP_WHITESPACE ();
c = get_symbol_name (&name);
p = input_line_pointer;
unwind.personality_routine = symbol_find_or_make (name);
unwind.force_unwind_entry = 1;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
demand_empty_rest_of_line ();
}
static void
dot_proc (int dummy ATTRIBUTE_UNUSED)
{
char *name, *p, c;
char *name, c;
symbolS *sym;
proc_pending *pending, *last_pending;
@ -4240,7 +4239,6 @@ dot_proc (int dummy ATTRIBUTE_UNUSED)
{
SKIP_WHITESPACE ();
c = get_symbol_name (&name);
p = input_line_pointer;
if (!*name)
as_bad (_("Empty argument of .proc"));
else
@ -4261,8 +4259,8 @@ dot_proc (int dummy ATTRIBUTE_UNUSED)
}
symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION;
}
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
break;
++input_line_pointer;
@ -4494,11 +4492,10 @@ dot_endp (int dummy ATTRIBUTE_UNUSED)
/* Parse names of main and alternate entry points. */
while (1)
{
char *name, *p, c;
char *name, c;
SKIP_WHITESPACE ();
c = get_symbol_name (&name);
p = input_line_pointer;
if (!*name)
(md.unwind_check == unwind_check_warning
? as_warn
@ -4518,8 +4515,8 @@ dot_endp (int dummy ATTRIBUTE_UNUSED)
if (!sym || !pending)
as_warn (_("`%s' was not specified with previous .proc"), name);
}
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
break;
++input_line_pointer;
@ -4607,9 +4604,9 @@ dot_rot (int type)
{
ch = get_symbol_name (&start);
len = strlen (ia64_canonicalize_symbol_name (start));
*input_line_pointer = ch;
restore_line_pointer (ch);
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (*input_line_pointer != '[')
{
as_bad (_("Expected '['"));
@ -4740,9 +4737,9 @@ dot_psr (int dummy ATTRIBUTE_UNUSED)
md.flags |= EF_IA_64_ABI64;
else
as_bad (_("Unknown psr option `%s'"), option);
*input_line_pointer = ch;
restore_line_pointer (ch);
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
break;
@ -5159,8 +5156,8 @@ dot_entry (int dummy ATTRIBUTE_UNUSED)
if (str_hash_insert (md.entry_hash, S_GET_NAME (symbolP), symbolP, 0))
as_bad (_("duplicate entry hint %s"), name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
c = *input_line_pointer;
if (c == ',')
{
@ -11731,7 +11728,7 @@ dot_alias (int section)
delim = get_symbol_name (&name);
end_name = input_line_pointer;
*end_name = delim;
restore_line_pointer (delim);
if (name == end_name)
{
@ -11740,7 +11737,7 @@ dot_alias (int section)
return;
}
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{

View File

@ -1483,8 +1483,8 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED)
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
as_bad (_("Expected comma after symbol-name: rest of line ignored."));

View File

@ -16509,8 +16509,8 @@ s_mips_globl (int x ATTRIBUTE_UNUSED)
symbolP = symbol_find_or_make (name);
S_SET_EXTERNAL (symbolP);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (!is_end_of_line[(unsigned char) *input_line_pointer]
&& (*input_line_pointer != ','))
@ -17569,9 +17569,9 @@ s_mips_weakext (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (&name);
symbolP = symbol_find_or_make (name);
S_SET_WEAK (symbolP);
*input_line_pointer = c;
restore_line_pointer (c);
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (! is_end_of_line[(unsigned char) *input_line_pointer])
{

View File

@ -2392,8 +2392,8 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED)
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
as_bad (_("expected comma after symbol-name: rest of line ignored."));
@ -2492,8 +2492,8 @@ ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED)
elf_symbol_type *elfsym;
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
*p = 0;
@ -5036,8 +5036,8 @@ ppc_ref (int ignore ATTRIBUTE_UNUSED)
fix_at_start (symbol_get_frag (ppc_current_csect), 0,
symbol_find_or_make (name), 0, false, BFD_RELOC_NONE);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
c = *input_line_pointer;
if (c == ',')
{

View File

@ -5912,7 +5912,7 @@ s7_s_score_lcomm (int bytes_p)
c = get_symbol_name (&name);
p = input_line_pointer;
*p = c;
restore_line_pointer (c);
if (name == p)
{
@ -5921,7 +5921,7 @@ s7_s_score_lcomm (int bytes_p)
return;
}
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
/* Accept an optional comma after the name. The comma used to be
required, but Irix 5 cc does not generate it. */

View File

@ -4119,8 +4119,8 @@ s_reserve (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (&name);
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
@ -4246,8 +4246,8 @@ s_common (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (&name);
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
as_bad (_("Expected comma after symbol-name"));

View File

@ -800,8 +800,8 @@ tic4x_globl (int ignore ATTRIBUTE_UNUSED)
{
c = get_symbol_name (&name);
symbolP = symbol_find_or_make (name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
S_SET_STORAGE_CLASS (symbolP, C_EXT);
S_SET_EXTERNAL (symbolP);
if (c == ',')

View File

@ -1573,8 +1573,8 @@ xtensa_literal_pseudo (int ignored ATTRIBUTE_UNUSED)
c = get_symbol_name (&base_name);
/* Just after name is now '\0'. */
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',' && *input_line_pointer != ':')
{

View File

@ -1245,8 +1245,8 @@ dot_cfi_sections (int ignored ATTRIBUTE_UNUSED)
break;
}
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
{
name = input_line_pointer++;

View File

@ -1326,21 +1326,21 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
if (strcmp (p, "basic_block") == 0)
{
current.flags |= DWARF2_FLAG_BASIC_BLOCK;
*input_line_pointer = c;
restore_line_pointer (c);
}
else if (strcmp (p, "prologue_end") == 0)
{
if (dwarf_level < 3)
dwarf_level = 3;
current.flags |= DWARF2_FLAG_PROLOGUE_END;
*input_line_pointer = c;
restore_line_pointer (c);
}
else if (strcmp (p, "epilogue_begin") == 0)
{
if (dwarf_level < 3)
dwarf_level = 3;
current.flags |= DWARF2_FLAG_EPILOGUE_BEGIN;
*input_line_pointer = c;
restore_line_pointer (c);
}
else if (strcmp (p, "is_stmt") == 0)
{
@ -1442,7 +1442,7 @@ dwarf2_directive_loc (int dummy ATTRIBUTE_UNUSED)
return;
}
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
}
demand_empty_rest_of_line ();

View File

@ -1253,8 +1253,8 @@ operand (expressionS *expressionP, enum expr_mode mode)
expressionP->X_add_symbol = symbol_lookup_or_make (name, start);
expressionP->X_add_number = 0;
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ')')
as_bad (_("syntax error in .startof. or .sizeof."));
else

View File

@ -3090,8 +3090,8 @@ s_purgem (int ignore ATTRIBUTE_UNUSED)
SKIP_WHITESPACE ();
c = get_symbol_name (& name);
delete_macro (name);
*input_line_pointer = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
}
while (*input_line_pointer++ == ',');
@ -4401,7 +4401,7 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
}
else
reloc->u.a.howto = bfd_reloc_name_lookup (stdoutput, r_name);
*input_line_pointer = c;
restore_line_pointer (c);
if (reloc->u.a.howto == NULL)
{
as_bad (_("unrecognized reloc type"));
@ -4409,7 +4409,7 @@ s_reloc (int ignore ATTRIBUTE_UNUSED)
}
exp.X_op = O_absent;
SKIP_WHITESPACE_AFTER_NAME ();
SKIP_WHITESPACE ();
if (*input_line_pointer == ',')
{
++input_line_pointer;
@ -6528,8 +6528,8 @@ do_s_func (int end_p, const char *default_prefix)
delim1 = get_symbol_name (& name);
name = xstrdup (name);
*input_line_pointer = delim1;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (delim1);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
if (default_prefix)

View File

@ -37,16 +37,6 @@ extern bool input_from_string;
#define SKIP_ALL_WHITESPACE() SKIP_WHITESPACE()
#endif
#define SKIP_WHITESPACE_AFTER_NAME() \
do \
{ \
if (* input_line_pointer == '"') \
++ input_line_pointer; \
if (* input_line_pointer == ' ') \
++ input_line_pointer; \
} \
while (0)
#define LEX_NAME (1) /* may continue a name */
#define LEX_BEGIN_NAME (2) /* may begin a name */
#define LEX_END_NAME (4) /* ends a name */

View File

@ -453,8 +453,8 @@ s_desc (int ignore ATTRIBUTE_UNUSED)
c = get_symbol_name (&name);
p = input_line_pointer;
*p = c;
SKIP_WHITESPACE_AFTER_NAME ();
restore_line_pointer (c);
SKIP_WHITESPACE ();
if (*input_line_pointer != ',')
{
*p = 0;