From d02603dc201f80cd9d2a1f4b1a16110b1e04222b Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 21 Aug 2015 16:42:14 +0100 Subject: Allow symbol and label names to be enclosed in double quotes. gas PR gas/18581 * expr.c (get_symbol_end): Rename to get_symbol_name. Add a return parameter pointing to the start of the symbol. Allow symbol names enclosed in double quotes. (restore_line_pointer): New function. Replace the NUL character inserted into the input stream with the given character. If the character was a double quote, advance the input pointer. * expr.h (get_symbol_end): Delete. (get_symbol_name): Add prototype. (restore_line_pointer): Prototype. * read.h (SKIP_WHITESPACE_AFTER_NAME): New macro. * doc/as.texinfo (Symbol Intro): Document that symbol names can now be enclosed in double quotes. * cond.c (s_ifdef): Replace get_symbol_end with get_symbol_name. Use restore_line_pointer to replace the NUL in the input stream. Use SKIP_WHITESPACE_AFTER_NAME to skip past the end of a symbol. Check for the use of double quoted symbol names. * expr.c: Likewise. * config/obj-aout.c: Likewise. * config/obj-coff-seh.c: Likewise. * config/obj-coff.c: Likewise. * config/obj-elf.c: Likewise. * config/obj-evax.c: Likewise. * config/obj-macho.c: Likewise. * config/obj-som.c: Likewise. * config/tc-alpha.c: Likewise. * config/tc-arc.c: Likewise. * config/tc-arm.c: Likewise. * config/tc-dlx.c: Likewise. * config/tc-h8300.c: Likewise. * config/tc-hppa.c: Likewise. * config/tc-i370.c: Likewise. * config/tc-i386-intel.c: Likewise. * config/tc-i386.c: Likewise. * config/tc-i960.c: Likewise. * config/tc-ia64.c: Likewise. * config/tc-iq2000.c: Likewise. * config/tc-m32r.c: Likewise. * config/tc-m68hc11.c: Likewise. * config/tc-m68k.c: Likewise. * config/tc-microblaze.c: Likewise. * config/tc-mips.c: Likewise. * config/tc-mmix.c: Likewise. * config/tc-mn10200.c: Likewise. * config/tc-mn10300.c: Likewise. * config/tc-nios2.c: Likewise. * config/tc-ppc.c: Likewise. * config/tc-s390.c: Likewise. * config/tc-score.c: Likewise. * config/tc-score7.c: Likewise. * config/tc-sparc.c: Likewise. * config/tc-tic4x.c: Likewise. * config/tc-tic54x.c: Likewise. * config/tc-tic6x.c: Likewise. * config/tc-tilegx.c: Likewise. * config/tc-tilepro.c: Likewise. * config/tc-v850.c: Likewise. * config/tc-xtensa.c: Likewise. * config/tc-z80.c: Likewise. * dw2gencfi.c: Likewise. * dwarf2dbgc.: Likewise. * ecoff.c: Likewise. * read.c: Likewise. * stabs.c: Likewise. tests PR gas/18581 * gas/all/byte.d: Disable this test. Quoted expressions are now allowed in .byte directives. * gas/all/quoted-sym-names.s: New test. * gas/all/quoted-sym-names.d: Expected output. * gas/all/gas.exp: Run the new test. --- gas/config/obj-aout.c | 10 +-- gas/config/obj-coff-seh.c | 20 ++--- gas/config/obj-coff.c | 31 +++----- gas/config/obj-elf.c | 42 +++++----- gas/config/obj-evax.c | 5 +- gas/config/obj-macho.c | 20 +++-- gas/config/obj-som.c | 5 +- gas/config/tc-alpha.c | 90 +++++++++++---------- gas/config/tc-arc.c | 20 ++--- gas/config/tc-arm.c | 15 ++-- gas/config/tc-dlx.c | 10 +-- gas/config/tc-h8300.c | 2 +- gas/config/tc-hppa.c | 193 +++++++++++++++++++-------------------------- gas/config/tc-i370.c | 9 +-- gas/config/tc-i386-intel.c | 11 ++- gas/config/tc-i386.c | 36 +++++---- gas/config/tc-i960.c | 5 +- gas/config/tc-ia64.c | 105 ++++++++++-------------- gas/config/tc-iq2000.c | 5 +- gas/config/tc-m32r.c | 12 +-- gas/config/tc-m68hc11.c | 5 +- gas/config/tc-m68k.c | 13 ++- gas/config/tc-microblaze.c | 13 ++- gas/config/tc-mips.c | 51 ++++++------ gas/config/tc-mmix.c | 26 +++--- gas/config/tc-mn10200.c | 37 ++++----- gas/config/tc-mn10300.c | 103 ++++++++++++------------ gas/config/tc-nios2.c | 7 +- gas/config/tc-ppc.c | 126 ++++++++++++----------------- gas/config/tc-s390.c | 29 +++---- gas/config/tc-score.c | 10 +-- gas/config/tc-score7.c | 10 +-- gas/config/tc-sparc.c | 21 +++-- gas/config/tc-tic4x.c | 51 ++++++------ gas/config/tc-tic54x.c | 70 ++++++++-------- gas/config/tc-tic6x.c | 13 ++- gas/config/tc-tilegx.c | 31 ++++---- gas/config/tc-tilepro.c | 5 +- gas/config/tc-v850.c | 68 ++++++++-------- gas/config/tc-xtensa.c | 8 +- gas/config/tc-z80.c | 7 +- 41 files changed, 606 insertions(+), 744 deletions(-) (limited to 'gas/config') diff --git a/gas/config/obj-aout.c b/gas/config/obj-aout.c index 5500ac9..401b3a7 100644 --- a/gas/config/obj-aout.c +++ b/gas/config/obj-aout.c @@ -152,10 +152,9 @@ obj_aout_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); S_SET_WEAK (symbolP); if (c == ',') @@ -182,10 +181,9 @@ obj_aout_type (int ignore ATTRIBUTE_UNUSED) int c; symbolS *sym; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer == ',') { diff --git a/gas/config/obj-coff-seh.c b/gas/config/obj-coff-seh.c index 2ffefa8..ec53585 100644 --- a/gas/config/obj-coff-seh.c +++ b/gas/config/obj-coff-seh.c @@ -329,8 +329,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) if (*input_line_pointer == '@') { - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); seh_ctx_cur->handler.X_op = O_constant; seh_ctx_cur->handler.X_add_number = 0; @@ -343,7 +342,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) else as_bad (_("unknown constant value '%s' for handler"), symbol_name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } else expression (&seh_ctx_cur->handler); @@ -359,8 +358,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) { do { - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); if (strcasecmp (symbol_name, "@unwind") == 0) seh_ctx_cur->handler_flags |= UNW_FLAG_UHANDLER; @@ -369,7 +367,7 @@ obj_coff_seh_handler (int what ATTRIBUTE_UNUSED) else as_bad (_(".seh_handler constant '%s' unknown"), symbol_name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } while (skip_whitespace_and_comma (0)); } @@ -454,10 +452,9 @@ obj_coff_seh_proc (int what ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); seh_ctx_cur->func_name = xstrdup (symbol_name); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); @@ -549,14 +546,13 @@ seh_x64_read_reg (const char *directive, int kind) SKIP_WHITESPACE (); if (*input_line_pointer == '%') ++input_line_pointer; - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (& symbol_name); for (i = 0; i < 16; i++) if (! strcasecmp (regs[i], symbol_name)) break; - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); /* Error if register not found, or EAX used as a frame pointer. */ if (i == 16 || (kind == 0 && i == 0)) diff --git a/gas/config/obj-coff.c b/gas/config/obj-coff.c index 449cb4f..c0a3f1f 100644 --- a/gas/config/obj-coff.c +++ b/gas/config/obj-coff.c @@ -603,8 +603,7 @@ obj_coff_def (int what ATTRIBUTE_UNUSED) SKIP_WHITESPACES (); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); symbol_name_length = strlen (symbol_name); symbol_name_copy = xmalloc (symbol_name_length + 1); strcpy (symbol_name_copy, symbol_name); @@ -620,7 +619,7 @@ obj_coff_def (int what ATTRIBUTE_UNUSED) if (S_IS_STRING (def_symbol_in_progress)) SF_SET_STRING (def_symbol_in_progress); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -973,8 +972,7 @@ obj_coff_tag (int ignore ATTRIBUTE_UNUSED) } S_SET_NUMBER_AUXILIARY (def_symbol_in_progress, 1); - symbol_name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&symbol_name); #ifdef tc_canonicalize_symbol_name symbol_name = tc_canonicalize_symbol_name (symbol_name); @@ -988,8 +986,8 @@ obj_coff_tag (int ignore ATTRIBUTE_UNUSED) as_warn (_("tag not found for .tag %s"), symbol_name); SF_SET_TAGGED (def_symbol_in_progress); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } @@ -1024,11 +1022,11 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED) if (is_name_beginner (*input_line_pointer)) { - char *symbol_name = input_line_pointer; - char name_end = get_symbol_end (); + char *symbol_name; + char name_end = get_symbol_name (&symbol_name); #ifdef tc_canonicalize_symbol_name - symbol_name = tc_canonicalize_symbol_name (symbol_name); + symbol_name = tc_canonicalize_symbol_name (symbol_name); #endif if (streq (symbol_name, ".")) { @@ -1059,7 +1057,7 @@ obj_coff_val (int ignore ATTRIBUTE_UNUSED) } /* Otherwise, it is the name of a non debug symbol and its value will be calculated later. */ - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } else { @@ -1170,8 +1168,7 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if (*name == 0) { as_warn (_("badly formed .weak directive ignored")); @@ -1181,7 +1178,7 @@ obj_coff_weak (int ignore ATTRIBUTE_UNUSED) c = 0; symbolP = symbol_find_or_make (name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); S_SET_WEAK (symbolP); if (c == ',') @@ -1564,15 +1561,11 @@ obj_coff_section (int ignore ATTRIBUTE_UNUSED) return; } - section_name = input_line_pointer; - c = get_symbol_end (); - + c = get_symbol_name (§ion_name); name = xmalloc (input_line_pointer - section_name + 1); strcpy (name, section_name); - *input_line_pointer = c; - - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); exp = 0; flags = SEC_NO_FLAGS; diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 08ae853..031fafb 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -406,11 +406,10 @@ get_sym_from_input_line_and_check (void) char c; symbolS *sym; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& name); sym = symbol_find_or_make (name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* There is no symbol name if input_line_pointer has not moved. */ if (name == input_line_pointer) @@ -1043,9 +1042,9 @@ obj_elf_section (int push) } else if (c == '@' || c == '%') { - beg = ++input_line_pointer; - c = get_symbol_end (); - *input_line_pointer = c; + ++input_line_pointer; + c = get_symbol_name (& beg); + (void) restore_line_pointer (c); type = obj_elf_section_type (beg, input_line_pointer - beg, TRUE); } else @@ -1125,9 +1124,9 @@ obj_elf_section (int push) ignore_rest_of_line (); return; } - beg = ++input_line_pointer; - c = get_symbol_end (); - *input_line_pointer = c; + ++input_line_pointer; + c = get_symbol_name (& beg); + (void) restore_line_pointer (c); attr |= obj_elf_section_word (beg, input_line_pointer - beg, & type); @@ -1319,19 +1318,18 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED) ++input_line_pointer; SKIP_WHITESPACE (); - name = input_line_pointer; /* Temporarily include '@' in symbol names. */ old_lexat = lex_type[(unsigned char) '@']; lex_type[(unsigned char) '@'] |= LEX_NAME; - c = get_symbol_end (); + c = get_symbol_name (& name); lex_type[(unsigned char) '@'] = old_lexat; if (symbol_get_obj (sym)->versioned_name == NULL) { symbol_get_obj (sym)->versioned_name = xstrdup (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); if (strchr (symbol_get_obj (sym)->versioned_name, ELF_VER_CHR) == NULL) @@ -1354,7 +1352,7 @@ obj_elf_symver (int ignore ATTRIBUTE_UNUSED) return; } - *input_line_pointer = c; + (void) restore_line_pointer (c); } demand_empty_rest_of_line (); @@ -1374,8 +1372,7 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED) if (*input_line_pointer == '#') ++input_line_pointer; - cname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& cname); csym = symbol_find (cname); /* GCFIXME: should check that we don't have two .vtable_inherits for @@ -1391,7 +1388,7 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED) *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { as_bad (_("expected comma after name in .vtable_inherit")); @@ -1414,10 +1411,9 @@ obj_elf_vtable_inherit (int ignore ATTRIBUTE_UNUSED) } else { - pname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& pname); psym = symbol_find_or_make (pname); - *input_line_pointer = c; + restore_line_pointer (c); } demand_empty_rest_of_line (); @@ -1767,15 +1763,15 @@ obj_elf_version (int ignore ATTRIBUTE_UNUSED) static void obj_elf_size (int ignore ATTRIBUTE_UNUSED) { - char *name = input_line_pointer; - char c = get_symbol_end (); + char *name; + char c = get_symbol_name (&name); char *p; expressionS exp; symbolS *sym; p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { *p = 0; @@ -1847,7 +1843,7 @@ obj_elf_type_name (char *cp) *input_line_pointer = '\0'; } else - *cp = get_symbol_end (); + *cp = get_symbol_name (&p); return p; } diff --git a/gas/config/obj-evax.c b/gas/config/obj-evax.c index b3702ef..b712e13 100644 --- a/gas/config/obj-evax.c +++ b/gas/config/obj-evax.c @@ -60,10 +60,9 @@ s_evax_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); S_SET_WEAK (symbolP); if (c == ',') diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c index 10e8dbf..d0a4053 100644 --- a/gas/config/obj-macho.c +++ b/gas/config/obj-macho.c @@ -475,8 +475,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED) input_line_pointer++; /* Skip ',' */ SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; @@ -488,7 +487,7 @@ obj_mach_o_zerofill (int ignore ATTRIBUTE_UNUSED) goto done; } - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer == ',') input_line_pointer++; @@ -1133,12 +1132,11 @@ obj_mach_o_sym_qual (int ntype) do { - name = input_line_pointer; - c = get_symbol_end (); + 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 (); + SKIP_WHITESPACE_AFTER_NAME (); c = *input_line_pointer; if (c == ',') { @@ -1184,8 +1182,8 @@ obj_mach_o_indirect_symbol (int arg ATTRIBUTE_UNUSED) case BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS: { obj_mach_o_indirect_sym *isym; - char *name = input_line_pointer; - char c = get_symbol_end (); + char *name; + char c = get_symbol_name (&name); symbolS *sym = symbol_find_or_make (name); unsigned int elsize = bfd_mach_o_section_get_entry_size (stdoutput, sec); @@ -1195,11 +1193,11 @@ obj_mach_o_indirect_symbol (int arg ATTRIBUTE_UNUSED) as_bad (_("attempt to add an indirect_symbol to a stub or" " reference section with a zero-sized element at %s"), name); - *input_line_pointer = c; + (void) restore_line_pointer (c); ignore_rest_of_line (); return; - } - *input_line_pointer = c; + } + (void) restore_line_pointer (c); /* The indirect symbols are validated after the symbol table is frozen, we must make sure that if a local symbol is used as an diff --git a/gas/config/obj-som.c b/gas/config/obj-som.c index b085b89..1b87de5 100644 --- a/gas/config/obj-som.c +++ b/gas/config/obj-som.c @@ -302,11 +302,10 @@ obj_som_weak (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); S_SET_WEAK (symbolP); if (c == ',') { diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c index a19fbc5..5762e41 100644 --- a/gas/config/tc-alpha.c +++ b/gas/config/tc-alpha.c @@ -921,8 +921,7 @@ tokenize_arguments (char *str, ++input_line_pointer; SKIP_WHITESPACE (); - p = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&p); /* Parse !relocation_type. */ len = input_line_pointer - p; @@ -943,7 +942,7 @@ tokenize_arguments (char *str, } *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != '!') { if (r->require_seq) @@ -3494,14 +3493,13 @@ s_alpha_comm (int ignore ATTRIBUTE_UNUSED) int log_align = 0; #endif - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* Alpha OSF/1 compiler doesn't provide the comma, gcc does. */ if (*input_line_pointer == ',') @@ -3714,15 +3712,15 @@ s_alpha_ent (int dummy ATTRIBUTE_UNUSED) else { char *name, name_end; - name = input_line_pointer; - name_end = get_symbol_end (); + + name_end = get_symbol_name (&name); /* CFI_EMIT_eh_frame is the default. */ all_cfi_sections = CFI_EMIT_eh_frame; if (! is_name_beginner (*name)) { as_warn (_(".ent directive has no name")); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); } else { @@ -3748,7 +3746,7 @@ 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 (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer == ',') { input_line_pointer++; @@ -3769,13 +3767,12 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED) else { char *name, name_end; - name = input_line_pointer; - name_end = get_symbol_end (); + + name_end = get_symbol_name (&name); if (! is_name_beginner (*name)) { as_warn (_(".end directive has no name")); - *input_line_pointer = name_end; } else { @@ -3803,9 +3800,9 @@ s_alpha_end (int dummy ATTRIBUTE_UNUSED) } cur_frame_data = NULL; - - *input_line_pointer = name_end; } + + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); } } @@ -4130,19 +4127,20 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) symbolS *sym; int other; - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (! is_name_beginner (*name)) { as_bad (_(".usepv directive has no name")); - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); ignore_rest_of_line (); return; } sym = symbol_find_or_make (name); - *input_line_pointer++ = name_end; + name_end = restore_line_pointer (name_end); + if (! is_end_of_line[(unsigned char) name_end]) + input_line_pointer++; if (name_end != ',') { @@ -4152,8 +4150,8 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) } SKIP_WHITESPACE (); - which = input_line_pointer; - which_end = get_symbol_end (); + + which_end = get_symbol_name (&which); if (strcmp (which, "no") == 0) other = STO_ALPHA_NOPV; @@ -4165,7 +4163,7 @@ s_alpha_usepv (int unused ATTRIBUTE_UNUSED) other = 0; } - *input_line_pointer = which_end; + (void) restore_line_pointer (which_end); demand_empty_rest_of_line (); S_SET_OTHER (sym, other | (S_GET_OTHER (sym) & ~STO_ALPHA_STD_GPLOAD)); @@ -4319,15 +4317,15 @@ s_alpha_section (int secid) char c; SKIP_WHITESPACE (); - beg = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&beg); *input_line_pointer = c; vms_flags |= s_alpha_section_word (beg, input_line_pointer - beg); - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); } while (*input_line_pointer++ == ','); + --input_line_pointer; } @@ -4411,13 +4409,12 @@ s_alpha_handler (int is_data) else { char *name, name_end; - name = input_line_pointer; - name_end = get_symbol_end (); + + name_end = get_symbol_name (&name); if (! is_name_beginner (*name)) { as_warn (_(".handler directive has no name")); - *input_line_pointer = name_end; } else { @@ -4426,9 +4423,11 @@ s_alpha_handler (int is_data) sym = symbol_find_or_make (name); symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; alpha_evax_proc->handler = sym; - *input_line_pointer = name_end; } - } + + (void) restore_line_pointer (name_end); + } + demand_empty_rest_of_line (); } @@ -4547,8 +4546,7 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) } SKIP_WHITESPACE (); - name = input_line_pointer; - name_end = get_symbol_end (); + name_end = get_symbol_name (&name); if (strncmp (name, "stack", 5) == 0) alpha_evax_proc->pdsckind = PDSC_S_K_KIND_FP_STACK; @@ -4561,12 +4559,13 @@ s_alpha_pdesc (int ignore ATTRIBUTE_UNUSED) else { + (void) restore_line_pointer (name_end); as_fatal (_("unknown procedure kind")); demand_empty_rest_of_line (); return; } - *input_line_pointer = name_end; + (void) restore_line_pointer (name_end); demand_empty_rest_of_line (); #ifdef md_flush_pending_output @@ -4804,10 +4803,11 @@ s_alpha_fmask (int ignore ATTRIBUTE_UNUSED) static void s_alpha_end (int ignore ATTRIBUTE_UNUSED) { + char *name; char c; - c = get_symbol_end (); - *input_line_pointer = c; + c = get_symbol_name (&name); + (void) restore_line_pointer (c); demand_empty_rest_of_line (); alpha_evax_proc = NULL; } @@ -4938,12 +4938,11 @@ s_alpha_proc (int is_static ATTRIBUTE_UNUSED) /* Takes ".proc name,nargs". */ SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; symbolP = symbol_find_or_make (name); *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { *p = 0; @@ -4973,9 +4972,8 @@ s_alpha_set (int x ATTRIBUTE_UNUSED) int yesno = 1; SKIP_WHITESPACE (); - name = input_line_pointer; - ch = get_symbol_end (); + ch = get_symbol_name (&name); s = name; if (s[0] == 'n' && s[1] == 'o') { @@ -4995,7 +4993,7 @@ s_alpha_set (int x ATTRIBUTE_UNUSED) else as_warn (_("Tried to .set unrecognized mode `%s'"), name); - *input_line_pointer = ch; + (void) restore_line_pointer (ch); demand_empty_rest_of_line (); } @@ -5130,8 +5128,8 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED) const struct cpu_type *p; SKIP_WHITESPACE (); - name = input_line_pointer; - ch = get_symbol_end (); + + ch = get_symbol_name (&name); for (p = cpu_types; p->name; ++p) if (strcmp (name, p->name) == 0) @@ -5142,7 +5140,7 @@ s_alpha_arch (int ignored ATTRIBUTE_UNUSED) as_warn (_("Unknown CPU identifier `%s'"), name); found: - *input_line_pointer = ch; + (void) restore_line_pointer (ch); demand_empty_rest_of_line (); } @@ -6334,8 +6332,8 @@ tc_get_register (int frame ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); if (*input_line_pointer == '$') { - char *s = input_line_pointer; - char c = get_symbol_end (); + char *s; + char c = get_symbol_name (&s); symbolS *sym = md_undefined_symbol (s); *strchr (s, '\0') = c; diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c index df3ed1f..4806ed8 100644 --- a/gas/config/tc-arc.c +++ b/gas/config/tc-arc.c @@ -410,8 +410,7 @@ arc_extoper (int opertype) segT old_sec; int old_subsec; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); name = xstrdup (name); p = name; @@ -423,7 +422,7 @@ arc_extoper (int opertype) /* just after name is now '\0' */ p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer != ',') @@ -653,15 +652,14 @@ arc_extinst (int ignore ATTRIBUTE_UNUSED) segT old_sec; int old_subsec; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); name = xstrdup (name); strcpy (syntax, name); name_len = strlen (name); /* just after name is now '\0' */ p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); @@ -849,11 +847,10 @@ arc_common (int localScope) int align, size; symbolS *symbolP; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* just after name is now '\0' */ p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer != ',') @@ -959,10 +956,9 @@ arc_option (int ignore ATTRIBUTE_UNUSED) char c; char *cpu; - cpu = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&cpu); mach = arc_get_mach (cpu); - *input_line_pointer = c; + (void) restore_line_pointer (c); /* If an instruction has already been seen, it's too late. */ if (cpu_tables_init_p) diff --git a/gas/config/tc-arm.c b/gas/config/tc-arm.c index e54b81b..68581cb 100644 --- a/gas/config/tc-arm.c +++ b/gas/config/tc-arm.c @@ -2868,10 +2868,9 @@ s_thumb_set (int equiv) /* Especial apologies for the random logic: This just grew, and could be parsed much more simply! Dean - in haste. */ - name = input_line_pointer; - delim = get_symbol_end (); + delim = get_symbol_name (& name); end_name = input_line_pointer; - *end_name = delim; + (void) restore_line_pointer (delim); if (*input_line_pointer != ',') { @@ -2951,8 +2950,7 @@ s_syntax (int unused ATTRIBUTE_UNUSED) { char *name, delim; - name = input_line_pointer; - delim = get_symbol_end (); + delim = get_symbol_name (& name); if (!strcasecmp (name, "unified")) unified_syntax = TRUE; @@ -2963,7 +2961,7 @@ s_syntax (int unused ATTRIBUTE_UNUSED) as_bad (_("unrecognized syntax mode \"%s\""), name); return; } - *input_line_pointer = delim; + (void) restore_line_pointer (delim); demand_empty_rest_of_line (); } @@ -3880,9 +3878,10 @@ s_arm_unwind_personality (int ignored ATTRIBUTE_UNUSED) if (unwind.personality_routine || unwind.personality_index != -1) as_bad (_("duplicate .personality directive")); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (& name); p = input_line_pointer; + if (c == '"') + ++ input_line_pointer; unwind.personality_routine = symbol_find_or_make (name); *p = c; demand_empty_rest_of_line (); diff --git a/gas/config/tc-dlx.c b/gas/config/tc-dlx.c index a0a6021..955a457 100644 --- a/gas/config/tc-dlx.c +++ b/gas/config/tc-dlx.c @@ -230,11 +230,10 @@ s_proc (int end_p) return; } - name = input_line_pointer; - delim1 = get_symbol_end (); + delim1 = get_symbol_name (&name); name = xstrdup (name); *input_line_pointer = delim1; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { @@ -257,10 +256,9 @@ s_proc (int end_p) { ++input_line_pointer; SKIP_WHITESPACE (); - label = input_line_pointer; - delim2 = get_symbol_end (); + delim2 = get_symbol_name (&label); label = xstrdup (label); - *input_line_pointer = delim2; + (void) restore_line_pointer (delim2); } current_name = name; diff --git a/gas/config/tc-h8300.c b/gas/config/tc-h8300.c index 9609f2b..04aa283 100644 --- a/gas/config/tc-h8300.c +++ b/gas/config/tc-h8300.c @@ -384,7 +384,7 @@ parse_reg (char *src, op_type *mode, unsigned int *reg, int direction) char *end; int len; - /* Cribbed from get_symbol_end. */ + /* Cribbed from get_symbol_name. */ if (!is_name_beginner (*src) || *src == '\001') return 0; end = src + 1; diff --git a/gas/config/tc-hppa.c b/gas/config/tc-hppa.c index 06e222d..da17a29 100644 --- a/gas/config/tc-hppa.c +++ b/gas/config/tc-hppa.c @@ -5894,33 +5894,28 @@ pa_try (int begin ATTRIBUTE_UNUSED) static void pa_call_args (struct call_desc *call_desc) { - char *name, c, *p; + char *name, c; unsigned int temp, arg_reloc; while (!is_end_of_statement ()) { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Process a source argument. */ if ((strncasecmp (name, "argw", 4) == 0)) { temp = atoi (name + 4); - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); arg_reloc = pa_build_arg_reloc (name); call_desc->arg_reloc |= pa_align_arg_reloc (temp, arg_reloc); } /* Process a return value. */ else if ((strncasecmp (name, "rtnval", 6) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); arg_reloc = pa_build_arg_reloc (name); call_desc->arg_reloc |= (arg_reloc & 0x3); } @@ -5928,8 +5923,8 @@ pa_call_args (struct call_desc *call_desc) { as_bad (_("Invalid .CALL argument: %s"), name); } - p = input_line_pointer; - *p = c; + + (void) restore_line_pointer (c); if (!is_end_of_statement ()) input_line_pointer++; } @@ -6064,7 +6059,7 @@ pa_build_unwind_subspace (struct call_info *call_info) static void pa_callinfo (int unused ATTRIBUTE_UNUSED) { - char *name, c, *p; + char *name, c; int temp; #ifdef OBJ_SOM @@ -6083,13 +6078,11 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED) /* Iterate over the .CALLINFO arguments. */ while (!is_end_of_statement ()) { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Frame size specification. */ if ((strncasecmp (name, "frame", 5) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; temp = get_absolute_expression (); if ((temp & 0x3) != 0) @@ -6100,13 +6093,11 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED) /* callinfo is in bytes and unwind_desc is in 8 byte units. */ last_call_info->ci_unwind.descriptor.frame_size = temp / 8; - } /* Entry register (GR, GR and SR) specifications. */ else if ((strncasecmp (name, "entry_gr", 8) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; temp = get_absolute_expression (); /* The HP assembler accepts 19 as the high bound for ENTRY_GR @@ -6118,8 +6109,7 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED) } else if ((strncasecmp (name, "entry_fr", 8) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; temp = get_absolute_expression (); /* Similarly the HP assembler takes 31 as the high bound even @@ -6130,53 +6120,46 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED) } else if ((strncasecmp (name, "entry_sr", 8) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; temp = get_absolute_expression (); if (temp != 3) as_bad (_("Value for ENTRY_SR must be 3\n")); } /* Note whether or not this function performs any calls. */ - else if ((strncasecmp (name, "calls", 5) == 0) || - (strncasecmp (name, "caller", 6) == 0)) + else if ((strncasecmp (name, "calls", 5) == 0) + || (strncasecmp (name, "caller", 6) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); } else if ((strncasecmp (name, "no_calls", 8) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); } /* Should RP be saved into the stack. */ else if ((strncasecmp (name, "save_rp", 7) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); last_call_info->ci_unwind.descriptor.save_rp = 1; } /* Likewise for SP. */ else if ((strncasecmp (name, "save_sp", 7) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); last_call_info->ci_unwind.descriptor.save_sp = 1; } /* Is this an unwindable procedure. If so mark it so in the unwind descriptor. */ else if ((strncasecmp (name, "no_unwind", 9) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); last_call_info->ci_unwind.descriptor.cannot_unwind = 1; } /* Is this an interrupt routine. If so mark it in the unwind descriptor. */ else if ((strncasecmp (name, "hpux_int", 7) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); last_call_info->ci_unwind.descriptor.hpux_interrupt_marker = 1; } /* Is this a millicode routine. "millicode" isn't in my @@ -6185,15 +6168,15 @@ pa_callinfo (int unused ATTRIBUTE_UNUSED) to drop the information, so we'll accept it too. */ else if ((strncasecmp (name, "millicode", 9) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); last_call_info->ci_unwind.descriptor.millicode = 1; } else { as_bad (_("Invalid .CALLINFO argument: %s"), name); - *input_line_pointer = c; + (void) restore_line_pointer (c); } + if (!is_end_of_statement ()) input_line_pointer++; } @@ -6554,7 +6537,7 @@ pa_exit (int unused ATTRIBUTE_UNUSED) static void pa_type_args (symbolS *symbolP, int is_export) { - char *name, c, *p; + char *name, c; unsigned int temp, arg_reloc; pa_symbol_type type = SYMBOL_TYPE_UNKNOWN; asymbol *bfdsym = symbol_get_bfdsym (symbolP); @@ -6651,60 +6634,56 @@ pa_type_args (symbolS *symbolP, int is_export) { if (*input_line_pointer == ',') input_line_pointer++; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Argument sources. */ if ((strncasecmp (name, "argw", 4) == 0)) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; temp = atoi (name + 4); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); arg_reloc = pa_align_arg_reloc (temp, pa_build_arg_reloc (name)); #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC) symbol_arg_reloc_info (symbolP) |= arg_reloc; #else (void) arg_reloc; #endif - *input_line_pointer = c; + (void) restore_line_pointer (c); } /* The return value. */ else if ((strncasecmp (name, "rtnval", 6)) == 0) { - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); arg_reloc = pa_build_arg_reloc (name); #if defined (OBJ_SOM) || defined (ELF_ARG_RELOC) symbol_arg_reloc_info (symbolP) |= arg_reloc; #else (void) arg_reloc; #endif - *input_line_pointer = c; + (void) restore_line_pointer (c); } /* Privilege level. */ else if ((strncasecmp (name, "priv_lev", 8)) == 0) { - p = input_line_pointer; - *p = c; + char *priv; + + (void) restore_line_pointer (c); input_line_pointer++; temp = atoi (input_line_pointer); #ifdef OBJ_SOM ((obj_symbol_type *) bfdsym)->tc_data.ap.hppa_priv_level = temp; #endif - c = get_symbol_end (); - *input_line_pointer = c; + c = get_symbol_name (&priv); + (void) restore_line_pointer (c); } else { as_bad (_("Undefined .EXPORT/.IMPORT argument (ignored): %s"), name); - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); } + if (!is_end_of_statement ()) input_line_pointer++; } @@ -6717,17 +6696,15 @@ pa_type_args (symbolS *symbolP, int is_export) static void pa_export (int unused ATTRIBUTE_UNUSED) { - char *name, c, *p; + char *name, c; symbolS *symbol; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Make sure the given symbol exists. */ if ((symbol = symbol_find_or_make (name)) == NULL) { as_bad (_("Cannot define export symbol: %s\n"), name); - p = input_line_pointer; - *p = c; + restore_line_pointer (c); input_line_pointer++; } else @@ -6739,8 +6716,7 @@ pa_export (int unused ATTRIBUTE_UNUSED) set BSF_GLOBAL when we get back. */ S_SET_EXTERNAL (symbol); symbol_get_bfdsym (symbol)->flags |= BSF_GLOBAL; - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); if (!is_end_of_statement ()) { input_line_pointer++; @@ -6758,11 +6734,10 @@ pa_export (int unused ATTRIBUTE_UNUSED) static void pa_import (int unused ATTRIBUTE_UNUSED) { - char *name, c, *p; + char *name, c; symbolS *symbol; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbol = symbol_find (name); /* Ugh. We might be importing a symbol defined earlier in the file, @@ -6771,8 +6746,7 @@ pa_import (int unused ATTRIBUTE_UNUSED) if (symbol == NULL || !S_IS_DEFINED (symbol)) { symbol = symbol_find_or_make (name); - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); if (!is_end_of_statement ()) { @@ -6809,16 +6783,14 @@ pa_import (int unused ATTRIBUTE_UNUSED) static void pa_label (int unused ATTRIBUTE_UNUSED) { - char *name, c, *p; + char *name, c; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if (strlen (name) > 0) { colon (name); - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); } else { @@ -6907,24 +6879,21 @@ pa_origin (int unused ATTRIBUTE_UNUSED) static void pa_param (int unused ATTRIBUTE_UNUSED) { - char *name, c, *p; + char *name, c; symbolS *symbol; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if ((symbol = symbol_find_or_make (name)) == NULL) { as_bad (_("Cannot define static symbol: %s\n"), name); - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); input_line_pointer++; } else { S_CLEAR_EXTERNAL (symbol); - p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); if (!is_end_of_statement ()) { input_line_pointer++; @@ -7161,39 +7130,38 @@ pa_parse_space_stmt (char *space_name, int create_flag) while (!is_end_of_statement ()) { input_line_pointer++; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if ((strncasecmp (name, "spnum", 5) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer++; spnum = get_absolute_expression (); } else if ((strncasecmp (name, "sort", 4) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer++; sort = get_absolute_expression (); } else if ((strncasecmp (name, "unloadable", 10) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); loadable = FALSE; } else if ((strncasecmp (name, "notdefined", 10) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); defined = FALSE; } else if ((strncasecmp (name, "private", 7) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); private = TRUE; } else { as_bad (_("Invalid .SPACE argument")); - *input_line_pointer = c; + (void) restore_line_pointer (c); if (!is_end_of_statement ()) input_line_pointer++; } @@ -7331,11 +7299,10 @@ pa_space (int unused ATTRIBUTE_UNUSED) /* Not a number, attempt to create a new space. */ print_errors = 1; input_line_pointer = save_s; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); space_name = xmalloc (strlen (name) + 1); strcpy (space_name, name); - *input_line_pointer = c; + (void) restore_line_pointer (c); sd_chain = pa_parse_space_stmt (space_name, 1); current_space = sd_chain; @@ -7357,8 +7324,7 @@ pa_spnum (int unused ATTRIBUTE_UNUSED) char *p; sd_chain_struct *space; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); space = is_defined_space (name); if (space) { @@ -7368,7 +7334,7 @@ pa_spnum (int unused ATTRIBUTE_UNUSED) else as_warn (_("Undefined space: '%s' Assuming space number = 0."), name); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -7398,11 +7364,10 @@ pa_subspace (int create_new) } else { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); ss_name = xmalloc (strlen (name) + 1); strcpy (ss_name, name); - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Load default values. */ sort = 0; @@ -7466,17 +7431,16 @@ pa_subspace (int create_new) input_line_pointer++; while (!is_end_of_statement ()) { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if ((strncasecmp (name, "quad", 4) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer++; quadrant = get_absolute_expression (); } else if ((strncasecmp (name, "align", 5) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer++; alignment = get_absolute_expression (); if (exact_log2 (alignment) == -1) @@ -7487,50 +7451,51 @@ pa_subspace (int create_new) } else if ((strncasecmp (name, "access", 6) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer++; access_ctr = get_absolute_expression (); } else if ((strncasecmp (name, "sort", 4) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer++; sort = get_absolute_expression (); } else if ((strncasecmp (name, "code_only", 9) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); code_only = 1; } else if ((strncasecmp (name, "unloadable", 10) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); loadable = 0; } else if ((strncasecmp (name, "comdat", 6) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); comdat = 1; } else if ((strncasecmp (name, "common", 6) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); common = 1; } else if ((strncasecmp (name, "dup_comm", 8) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); dup_common = 1; } else if ((strncasecmp (name, "zero", 4) == 0)) { - *input_line_pointer = c; + (void) restore_line_pointer (c); zero = 1; } else if ((strncasecmp (name, "first", 5) == 0)) as_bad (_("FIRST not supported as a .SUBSPACE argument")); else as_bad (_("Invalid .SUBSPACE argument")); + if (!is_end_of_statement ()) input_line_pointer++; } diff --git a/gas/config/tc-i370.c b/gas/config/tc-i370.c index 6993f79..ba82b2c 100644 --- a/gas/config/tc-i370.c +++ b/gas/config/tc-i370.c @@ -269,11 +269,11 @@ register_name (expressionS *expressionP) reg_number = get_single_number (); else { - c = get_symbol_end (); + c = get_symbol_name (&name); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); } /* If numeric, make sure its not out of bounds. */ @@ -1033,12 +1033,11 @@ i370_elf_lcomm (int unused ATTRIBUTE_UNUSED) char *pfrag; int align2; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer != ',') { diff --git a/gas/config/tc-i386-intel.c b/gas/config/tc-i386-intel.c index 2bdcf35..cff0ae7 100644 --- a/gas/config/tc-i386-intel.c +++ b/gas/config/tc-i386-intel.c @@ -168,13 +168,18 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc) for (j = 0; i386_types[j].name; ++j) if (strcasecmp (i386_types[j].name, name) == 0) break; + if (i386_types[j].name && *pc == ' ') { - char *pname = ++input_line_pointer; - char c = get_symbol_end (); + char *pname; + char c; + + ++input_line_pointer; + c = get_symbol_name (&pname); if (strcasecmp (pname, "ptr") == 0) { + /* FIXME: What if c == '"' ? */ pname[-1] = *pc; *pc = c; if (intel_syntax > 0 || operands != 1) @@ -182,7 +187,7 @@ operatorT i386_operator (const char *name, unsigned int operands, char *pc) return i386_types[j].op; } - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = pname - 1; } diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index 6c910ed..13f1d27 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2198,8 +2198,8 @@ set_intel_syntax (int syntax_flag) SKIP_WHITESPACE (); if (!is_end_of_line[(unsigned char) *input_line_pointer]) { - char *string = input_line_pointer; - int e = get_symbol_end (); + char *string; + int e = get_symbol_name (&string); if (strcmp (string, "prefix") == 0) ask_naked_reg = 1; @@ -2207,7 +2207,7 @@ set_intel_syntax (int syntax_flag) ask_naked_reg = -1; else as_bad (_("bad argument to syntax directive.")); - *input_line_pointer = e; + (void) restore_line_pointer (e); } demand_empty_rest_of_line (); @@ -2259,8 +2259,8 @@ set_check (int what) if (!is_end_of_line[(unsigned char) *input_line_pointer]) { - char *string = input_line_pointer; - int e = get_symbol_end (); + char *string; + int e = get_symbol_name (&string); if (strcmp (string, "none") == 0) *kind = check_none; @@ -2270,7 +2270,7 @@ set_check (int what) *kind = check_error; else as_bad (_("bad argument to %s_check directive."), str); - *input_line_pointer = e; + (void) restore_line_pointer (e); } else as_bad (_("missing argument for %s_check directive"), str); @@ -2324,8 +2324,8 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) if (!is_end_of_line[(unsigned char) *input_line_pointer]) { - char *string = input_line_pointer; - int e = get_symbol_end (); + char *string; + int e = get_symbol_name (&string); unsigned int j; i386_cpu_flags flags; @@ -2385,7 +2385,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) cpu_arch_flags = flags; cpu_arch_isa_flags = flags; } - *input_line_pointer = e; + (void) restore_line_pointer (e); demand_empty_rest_of_line (); return; } @@ -2402,8 +2402,11 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) if (*input_line_pointer == ',' && !is_end_of_line[(unsigned char) input_line_pointer[1]]) { - char *string = ++input_line_pointer; - int e = get_symbol_end (); + char *string; + char e; + + ++input_line_pointer; + e = get_symbol_name (&string); if (strcmp (string, "nojumps") == 0) no_cond_jump_promotion = 1; @@ -2412,7 +2415,7 @@ set_cpu_arch (int dummy ATTRIBUTE_UNUSED) else as_bad (_("no such architecture modifier: `%s'"), string); - *input_line_pointer = e; + (void) restore_line_pointer (e); } demand_empty_rest_of_line (); @@ -3967,14 +3970,14 @@ parse_operands (char *l, const char *mnemonic) /* Skip optional white space before operand. */ if (is_space_char (*l)) ++l; - if (!is_operand_char (*l) && *l != END_OF_INSN) + if (!is_operand_char (*l) && *l != END_OF_INSN && *l != '"') { as_bad (_("invalid character %s before operand %d"), output_invalid (*l), i.operands + 1); return NULL; } - token_start = l; /* after white space */ + token_start = l; /* After white space. */ paren_not_balanced = 0; while (paren_not_balanced || *l != ',') { @@ -3993,7 +3996,7 @@ parse_operands (char *l, const char *mnemonic) else break; /* we are done */ } - else if (!is_operand_char (*l) && !is_space_char (*l)) + else if (!is_operand_char (*l) && !is_space_char (*l) && *l != '"') { as_bad (_("invalid character %s in operand %d"), output_invalid (*l), @@ -8637,6 +8640,7 @@ i386_att_operand (char *operand_string) } else if (is_digit_char (*op_string) || is_identifier_char (*op_string) + || *op_string == '"' || *op_string == '(') { /* This is a memory reference of some sort. */ @@ -9471,7 +9475,7 @@ parse_register (char *reg_string, char **end_op) symbolS *symbolP; input_line_pointer = reg_string; - c = get_symbol_end (); + c = get_symbol_name (®_string); symbolP = symbol_find (reg_string); if (symbolP && S_GET_SEGMENT (symbolP) == reg_section) { diff --git a/gas/config/tc-i960.c b/gas/config/tc-i960.c index 6321791..e27d816 100644 --- a/gas/config/tc-i960.c +++ b/gas/config/tc-i960.c @@ -2335,8 +2335,7 @@ s_endian (int ignore ATTRIBUTE_UNUSED) char *name; char c; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); if (strcasecmp (name, "little") == 0) ; else if (strcasecmp (name, "big") == 0) @@ -2344,7 +2343,7 @@ s_endian (int ignore ATTRIBUTE_UNUSED) else as_warn (_("ignoring unrecognized .endian type `%s'"), name); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c index d11570a..ea7dcc6 100644 --- a/gas/config/tc-ia64.c +++ b/gas/config/tc-ia64.c @@ -1084,19 +1084,18 @@ obj_elf_vms_common (int ignore ATTRIBUTE_UNUSED) return; } - sym_name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&sym_name); if (input_line_pointer == sym_name) { - *input_line_pointer = c; + (void) restore_line_pointer (c); as_bad (_("expected symbol name")); ignore_rest_of_line (); return; } symbolP = symbol_find_or_make (sym_name); - *input_line_pointer = c; + (void) restore_line_pointer (c); if ((S_IS_DEFINED (symbolP) || symbol_equated_p (symbolP)) && !S_IS_COMMON (symbolP)) @@ -3167,12 +3166,11 @@ dot_radix (int dummy ATTRIBUTE_UNUSED) if (is_it_end_of_statement ()) return; - radix = input_line_pointer; - ch = get_symbol_end (); + ch = get_symbol_name (&radix); ia64_canonicalize_symbol_name (radix); if (strcasecmp (radix, "C")) as_bad (_("Radix `%s' unsupported or invalid"), radix); - *input_line_pointer = ch; + (void) restore_line_pointer (ch); demand_empty_rest_of_line (); } @@ -3279,11 +3277,12 @@ add_unwind_entry (unw_rec_list *ptr, int sep) if (sep == ',') { + char *name; /* Parse a tag permitted for the current directive. */ int ch; SKIP_WHITESPACE (); - ch = get_symbol_end (); + ch = get_symbol_name (&name); /* FIXME: For now, just issue a warning that this isn't implemented. */ { static int warned; @@ -3294,7 +3293,7 @@ add_unwind_entry (unw_rec_list *ptr, int sep) as_warn (_("Tags on unwind pseudo-ops aren't supported, yet")); } } - *input_line_pointer = ch; + (void) restore_line_pointer (ch); } if (sep != NOT_A_CHAR) demand_empty_rest_of_line (); @@ -4232,16 +4231,16 @@ static void dot_personality (int dummy ATTRIBUTE_UNUSED) { char *name, *p, c; + if (!in_procedure ("personality")) return; SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + 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 (); + SKIP_WHITESPACE_AFTER_NAME (); demand_empty_rest_of_line (); } @@ -4271,8 +4270,7 @@ dot_proc (int dummy ATTRIBUTE_UNUSED) while (1) { SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; if (!*name) as_bad (_("Empty argument of .proc")); @@ -4295,7 +4293,7 @@ dot_proc (int dummy ATTRIBUTE_UNUSED) symbol_get_bfdsym (sym)->flags |= BSF_FUNCTION; } *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') break; ++input_line_pointer; @@ -4529,8 +4527,7 @@ dot_endp (int dummy ATTRIBUTE_UNUSED) char *name, *p, c; SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; if (!*name) (md.unwind_check == unwind_check_warning @@ -4552,7 +4549,7 @@ dot_endp (int dummy ATTRIBUTE_UNUSED) as_warn (_("`%s' was not specified with previous .proc"), name); } *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') break; ++input_line_pointer; @@ -4638,12 +4635,11 @@ dot_rot (int type) drpp = &md.dynreg[type]; while (1) { - start = input_line_pointer; - ch = get_symbol_end (); + ch = get_symbol_name (&start); len = strlen (ia64_canonicalize_symbol_name (start)); *input_line_pointer = ch; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != '[') { as_bad (_("Expected '['")); @@ -4769,8 +4765,7 @@ dot_psr (int dummy ATTRIBUTE_UNUSED) while (1) { - option = input_line_pointer; - ch = get_symbol_end (); + ch = get_symbol_name (&option); if (strcmp (option, "lsb") == 0) md.flags &= ~EF_IA_64_BE; else if (strcmp (option, "msb") == 0) @@ -4783,7 +4778,7 @@ dot_psr (int dummy ATTRIBUTE_UNUSED) as_bad (_("Unknown psr option `%s'"), option); *input_line_pointer = ch; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') break; @@ -4806,36 +4801,21 @@ cross_section (int ref, void (*builder) (int), int ua) char *start, *end; int saved_auto_align; unsigned int section_count; + char *name; + char c; SKIP_WHITESPACE (); start = input_line_pointer; - if (*start == '"') - { - int len; - char *name; - - name = demand_copy_C_string (&len); - obstack_free(¬es, name); - if (!name) - { - ignore_rest_of_line (); - return; - } - } - else + c = get_symbol_name (&name); + if (input_line_pointer == start) { - char c = get_symbol_end (); - - if (input_line_pointer == start) - { - as_bad (_("Missing section name")); - ignore_rest_of_line (); - return; - } - *input_line_pointer = c; + as_bad (_("Missing section name")); + ignore_rest_of_line (); + return; } + * input_line_pointer = c; + SKIP_WHITESPACE_AFTER_NAME (); end = input_line_pointer; - SKIP_WHITESPACE (); if (*input_line_pointer != ',') { as_bad (_("Comma expected after section name")); @@ -5068,8 +5048,11 @@ dot_pred_rel (int type) } else if (*input_line_pointer == '@') { - char *form = ++input_line_pointer; - char c = get_symbol_end(); + char *form; + char c; + + ++input_line_pointer; + c = get_symbol_name (&form); if (strcmp (form, "mutex") == 0) type = 'm'; @@ -5077,7 +5060,7 @@ dot_pred_rel (int type) type = 'c'; else if (strcmp (form, "imply") == 0) type = 'i'; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else { @@ -5215,8 +5198,7 @@ dot_entry (int dummy ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); err = hash_insert (md.entry_hash, S_GET_NAME (symbolP), (void *) symbolP); @@ -5225,7 +5207,7 @@ dot_entry (int dummy ATTRIBUTE_UNUSED) name, err); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); c = *input_line_pointer; if (c == ',') { @@ -7748,8 +7730,7 @@ ia64_unrecognized_line (int ch) recognize labels. */ if (is_name_beginner (*input_line_pointer)) { - s = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&s); } else if (LOCAL_LABELS_FB && ISDIGIT (*input_line_pointer)) @@ -10720,12 +10701,11 @@ md_assemble (char *str) /* extract the opcode (mnemonic): */ - mnemonic = input_line_pointer; - ch = get_symbol_end (); + ch = get_symbol_name (&mnemonic); pdesc = (struct pseudo_opcode *) hash_find (md.pseudo_hash, mnemonic); if (pdesc) { - *input_line_pointer = ch; + (void) restore_line_pointer (ch); (*pdesc->handler) (pdesc->arg); goto done; } @@ -10733,7 +10713,7 @@ md_assemble (char *str) /* Find the instruction descriptor matching the arguments. */ idesc = ia64_find_opcode (mnemonic); - *input_line_pointer = ch; + (void) restore_line_pointer (ch); if (!idesc) { as_bad (_("Unknown opcode `%s'"), mnemonic); @@ -11805,8 +11785,7 @@ dot_alias (int section) struct hash_control *ahash, *nhash; const char *kind; - name = input_line_pointer; - delim = get_symbol_end (); + delim = get_symbol_name (&name); end_name = input_line_pointer; *end_name = delim; @@ -11817,7 +11796,7 @@ dot_alias (int section) return; } - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { diff --git a/gas/config/tc-iq2000.c b/gas/config/tc-iq2000.c index bddd940..2d55da1 100644 --- a/gas/config/tc-iq2000.c +++ b/gas/config/tc-iq2000.c @@ -796,10 +796,9 @@ get_symbol (void) char *name; symbolS *p; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = (symbolS *) symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); return p; } diff --git a/gas/config/tc-m32r.c b/gas/config/tc-m32r.c index 38da4b5..4a14bf1 100644 --- a/gas/config/tc-m32r.c +++ b/gas/config/tc-m32r.c @@ -567,13 +567,10 @@ debug_sym (int ignore ATTRIBUTE_UNUSED) { char *name; char delim; - char *end_name; symbolS *symbolP; sym_linkS *lnk; - name = input_line_pointer; - delim = get_symbol_end (); - end_name = input_line_pointer; + delim = get_symbol_name (&name); if ((symbolP = symbol_find (name)) == NULL && (symbolP = md_undefined_symbol (name)) == NULL) @@ -595,7 +592,7 @@ debug_sym (int ignore ATTRIBUTE_UNUSED) symbol_get_obj (symbolP)->local = 1; } - *end_name = delim; + (void) restore_line_pointer (delim); demand_empty_rest_of_line (); } @@ -1480,13 +1477,12 @@ m32r_scomm (int ignore ATTRIBUTE_UNUSED) offsetT align; int align2; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { as_bad (_("Expected comma after symbol-name: rest of line ignored.")); diff --git a/gas/config/tc-m68hc11.c b/gas/config/tc-m68hc11.c index a2aa424..43cf6b6 100644 --- a/gas/config/tc-m68hc11.c +++ b/gas/config/tc-m68hc11.c @@ -3760,10 +3760,9 @@ s_m68hc11_mark_symbol (int mark) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index acfe349..b8f051e 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -5703,7 +5703,7 @@ mri_chip (void) int i; s = input_line_pointer; - /* We can't use get_symbol_end since the processor names are not proper + /* We can't use get_symbol_name since the processor names are not proper symbols. */ while (is_part_of_name (c = *input_line_pointer++)) ; @@ -5731,7 +5731,7 @@ mri_chip (void) { ++input_line_pointer; s = input_line_pointer; - /* We can't use get_symbol_end since the processor names are not + /* We can't use get_symbol_name since the processor names are not proper symbols. */ while (is_part_of_name (c = *input_line_pointer++)) ; @@ -5896,8 +5896,7 @@ s_opt (int ignore ATTRIBUTE_UNUSED) t = 0; } - s = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&s); for (i = 0, o = opt_table; i < OPTCOUNT; i++, o++) { @@ -5907,14 +5906,14 @@ s_opt (int ignore ATTRIBUTE_UNUSED) { /* Restore input_line_pointer now in case the option takes arguments. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); (*o->pfn) (o->arg, t); } else if (o->pvar != NULL) { if (! t && o->arg == o->notarg) as_bad (_("option `%s' may not be negated"), s); - *input_line_pointer = c; + restore_line_pointer (c); *o->pvar = t ? o->arg : o->notarg; } else @@ -5925,7 +5924,7 @@ s_opt (int ignore ATTRIBUTE_UNUSED) if (i >= OPTCOUNT) { as_bad (_("option `%s' not recognized"), s); - *input_line_pointer = c; + restore_line_pointer (c); } } while (*input_line_pointer++ == ','); diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c index 3309e59..b43925b 100644 --- a/gas/config/tc-microblaze.c +++ b/gas/config/tc-microblaze.c @@ -179,12 +179,11 @@ microblaze_s_lcomm (int xxx ATTRIBUTE_UNUSED) segT current_seg = now_seg; subsegT current_subseg = now_subseg; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer != ',') { @@ -315,7 +314,8 @@ microblaze_s_bss (int localvar) static void microblaze_s_func (int end_p ATTRIBUTE_UNUSED) { - *input_line_pointer = get_symbol_end (); + char *name; + restore_line_pointer (get_symbol_name (&name)); s_func (1); } @@ -329,11 +329,10 @@ microblaze_s_weakext (int ignore ATTRIBUTE_UNUSED) symbolS *symbolP; expressionS exp; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); S_SET_WEAK (symbolP); - *input_line_pointer = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c index 74b7fb4..d951dfc 100644 --- a/gas/config/tc-mips.c +++ b/gas/config/tc-mips.c @@ -15134,10 +15134,9 @@ get_symbol (void) char *name; symbolS *p; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = (symbolS *) symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); return p; } @@ -15280,28 +15279,34 @@ s_change_sec (int sec) void s_change_section (int ignore ATTRIBUTE_UNUSED) { + char *saved_ilp; char *section_name; - char c; + char c, endc; char next_c = 0; int section_type; int section_flag; int section_entry_size; int section_alignment; - section_name = input_line_pointer; - c = get_symbol_end (); + saved_ilp = input_line_pointer; + endc = get_symbol_name (§ion_name); + c = (endc == '"' ? input_line_pointer[1] : endc); if (c) - next_c = *(input_line_pointer + 1); + next_c = input_line_pointer [(endc == '"' ? 2 : 1)]; /* Do we have .section Name<,"flags">? */ if (c != ',' || (c == ',' && next_c == '"')) { - /* just after name is now '\0'. */ - *input_line_pointer = c; - input_line_pointer = section_name; + /* Just after name is now '\0'. */ + (void) restore_line_pointer (endc); + input_line_pointer = saved_ilp; obj_elf_section (ignore); return; } + + section_name = xstrdup (section_name); + c = restore_line_pointer (endc); + input_line_pointer++; /* Do we have .section Name<,type><,flag><,entry_size><,alignment> */ @@ -15309,23 +15314,25 @@ s_change_section (int ignore ATTRIBUTE_UNUSED) section_type = get_absolute_expression (); else section_type = 0; + if (*input_line_pointer++ == ',') section_flag = get_absolute_expression (); else section_flag = 0; + if (*input_line_pointer++ == ',') section_entry_size = get_absolute_expression (); else section_entry_size = 0; + if (*input_line_pointer++ == ',') section_alignment = get_absolute_expression (); else section_alignment = 0; + /* FIXME: really ignore? */ (void) section_alignment; - section_name = xstrdup (section_name); - /* When using the generic form of .section (as implemented by obj-elf.c), there's no way to set the section type to SHT_MIPS_DWARF. Users have traditionally had to fall back on the more common @progbits instead. @@ -15404,13 +15411,12 @@ s_mips_globl (int x ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); S_SET_EXTERNAL (symbolP); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* On Irix 5, every global symbol that is not explicitly labelled as being a function is apparently labelled as being an object. */ @@ -15422,12 +15428,11 @@ s_mips_globl (int x ATTRIBUTE_UNUSED) char *secname; asection *sec; - secname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&secname); sec = bfd_get_section_by_name (stdoutput, secname); if (sec == NULL) as_bad (_("%s: no such section"), secname); - *input_line_pointer = c; + (void) restore_line_pointer (c); if (sec != NULL && (sec->flags & SEC_CODE) != 0) flag = BSF_FUNCTION; @@ -15455,8 +15460,7 @@ s_option (int x ATTRIBUTE_UNUSED) char *opt; char c; - opt = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&opt); if (*opt == 'O') { @@ -15488,7 +15492,7 @@ s_option (int x ATTRIBUTE_UNUSED) else as_warn (_("unrecognized option \"%s\""), opt); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -16425,13 +16429,12 @@ s_mips_weakext (int ignore ATTRIBUTE_UNUSED) symbolS *symbolP; expressionS exp; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); S_SET_WEAK (symbolP); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (! is_end_of_line[(unsigned char) *input_line_pointer]) { diff --git a/gas/config/tc-mmix.c b/gas/config/tc-mmix.c index c5128cd..8d6ca3c 100644 --- a/gas/config/tc-mmix.c +++ b/gas/config/tc-mmix.c @@ -587,8 +587,10 @@ get_putget_operands (struct mmix_opcode *insn, char *operands, p++; sregp = p; input_line_pointer = sregp; - c = get_symbol_end (); + c = get_symbol_name (&sregp); sregend = input_line_pointer; + if (c == '"') + ++ input_line_pointer; } } else @@ -596,10 +598,10 @@ get_putget_operands (struct mmix_opcode *insn, char *operands, expp_sreg = &exp[0]; expp_reg = &exp[1]; - sregp = p; - c = get_symbol_end (); - sregend = p = input_line_pointer; - *p = c; + c = get_symbol_name (&sregp); + sregend = input_line_pointer; + restore_line_pointer (c); + p = input_line_pointer; /* Skip whitespace */ while (*p == ' ' || *p == '\t') @@ -1939,10 +1941,8 @@ s_prefix (int unused ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); - p = input_line_pointer; - - c = get_symbol_end (); - + c = get_symbol_name (&p); + /* Reseting prefix? */ if (*p == ':' && p[1] == 0) mmix_current_prefix = NULL; @@ -1961,7 +1961,7 @@ s_prefix (int unused ATTRIBUTE_UNUSED) mmix_current_prefix = p; } - *input_line_pointer = c; + (void) restore_line_pointer (c); mmix_handle_rest_of_empty_line (); } @@ -2057,13 +2057,15 @@ s_greg (int unused ATTRIBUTE_UNUSED) { char *p; char c; - p = input_line_pointer; /* This will skip over what can be a symbol and zero out the next character, which we assume is a ',' or other meaningful delimiter. What comes after that is the initializer expression for the register. */ - c = get_symbol_end (); + c = get_symbol_name (&p); + + if (c == '"') + c = * ++ input_line_pointer; if (! is_end_of_line[(unsigned char) c]) input_line_pointer++; diff --git a/gas/config/tc-mn10200.c b/gas/config/tc-mn10200.c index ebf7f94..4d4f482 100644 --- a/gas/config/tc-mn10200.c +++ b/gas/config/tc-mn10200.c @@ -181,13 +181,12 @@ data_register_name (expressionS *expressionP) char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (data_registers, DATA_REG_NAME_CNT, name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Look to see if it's in the register table. */ if (reg_number >= 0) @@ -226,13 +225,12 @@ address_register_name (expressionS *expressionP) char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (address_registers, ADDRESS_REG_NAME_CNT, name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Look to see if it's in the register table. */ if (reg_number >= 0) @@ -271,13 +269,12 @@ other_register_name (expressionS *expressionP) char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (other_registers, OTHER_REG_NAME_CNT, name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Look to see if it's in the register table. */ if (reg_number >= 0) @@ -980,32 +977,31 @@ md_assemble (char *str) } else if (operand->flags & MN10200_OPERAND_PSW) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcmp (start, "psw") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10200_OPERAND_MDR) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); + (void) restore_line_pointer (c); if (strcmp (start, "mdr") != 0) { - *input_line_pointer = c; input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; goto keep_going; } else if (data_register_name (&ex)) @@ -1337,4 +1333,3 @@ keep_going: } } } - diff --git a/gas/config/tc-mn10300.c b/gas/config/tc-mn10300.c index 1d37b29..0d13622 100644 --- a/gas/config/tc-mn10300.c +++ b/gas/config/tc-mn10300.c @@ -337,13 +337,13 @@ get_register_name (expressionS * expressionP, char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; + start = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); reg_number = reg_name_search (table, table_length, name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Look to see if it's in the register table. */ if (reg_number >= 0) @@ -409,13 +409,13 @@ other_register_name (expressionS *expressionP) char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; + start = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); reg_number = reg_name_search (other_registers, ARRAY_SIZE (other_registers), name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Look to see if it's in the register table. */ if (reg_number == 0 @@ -1346,17 +1346,17 @@ md_assemble (char *str) } else if (operand->flags & MN10300_OPERAND_SP) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "sp") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_RREG) @@ -1397,92 +1397,94 @@ md_assemble (char *str) } else if (operand->flags & MN10300_OPERAND_FPCR) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "fpcr") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_USP) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "usp") != 0) { + (void) restore_line_pointer (c); *input_line_pointer = c; input_line_pointer = hold; str = hold; goto error; } + (void) restore_line_pointer (c); *input_line_pointer = c; goto keep_going; } else if (operand->flags & MN10300_OPERAND_SSP) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "ssp") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_MSP) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "msp") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_PC) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "pc") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_EPSW) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "epsw") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_PLUS) @@ -1498,32 +1500,32 @@ md_assemble (char *str) } else if (operand->flags & MN10300_OPERAND_PSW) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "psw") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_MDR) { - char *start = input_line_pointer; - char c = get_symbol_end (); + char *start; + char c = get_symbol_name (&start); if (strcasecmp (start, "mdr") != 0) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = hold; str = hold; goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); goto keep_going; } else if (operand->flags & MN10300_OPERAND_REG_LIST) @@ -1554,57 +1556,56 @@ md_assemble (char *str) if (*input_line_pointer == ',') input_line_pointer++; - start = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&start); if (strcasecmp (start, "d2") == 0) { value |= 0x80; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (strcasecmp (start, "d3") == 0) { value |= 0x40; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (strcasecmp (start, "a2") == 0) { value |= 0x20; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (strcasecmp (start, "a3") == 0) { value |= 0x10; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (strcasecmp (start, "other") == 0) { value |= 0x08; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (HAVE_AM33 && strcasecmp (start, "exreg0") == 0) { value |= 0x04; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (HAVE_AM33 && strcasecmp (start, "exreg1") == 0) { value |= 0x02; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (HAVE_AM33 && strcasecmp (start, "exother") == 0) { value |= 0x01; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else if (HAVE_AM33 && strcasecmp (start, "all") == 0) { value |= 0xff; - *input_line_pointer = c; + (void) restore_line_pointer (c); } else { diff --git a/gas/config/tc-nios2.c b/gas/config/tc-nios2.c index 42bb115..8dd7604 100644 --- a/gas/config/tc-nios2.c +++ b/gas/config/tc-nios2.c @@ -566,10 +566,11 @@ s_nios2_sdata (int ignore ATTRIBUTE_UNUSED) static void s_nios2_set (int equiv) { - char *directive = input_line_pointer; - char delim = get_symbol_end (); + char *directive; + char delim = get_symbol_name (&directive); char *endline = input_line_pointer; - *endline = delim; + + (void) restore_line_pointer (delim); /* We only want to handle ".set XXX" if the user has tried ".set XXX, YYY" they are not diff --git a/gas/config/tc-ppc.c b/gas/config/tc-ppc.c index 8cff4dc..6e48f7a 100644 --- a/gas/config/tc-ppc.c +++ b/gas/config/tc-ppc.c @@ -860,7 +860,7 @@ register_name (expressionS *expressionP) else if (!reg_names_p || !ISALPHA (name[0])) return FALSE; - c = get_symbol_end (); + c = get_symbol_name (&name); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name); /* Put back the delimiting char. */ @@ -2142,13 +2142,12 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED) char *pfrag; int align2; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); - /* just after name is now '\0'. */ + /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { as_bad (_("expected comma after symbol-name: rest of line ignored.")); @@ -2238,8 +2237,8 @@ ppc_elf_lcomm (int xxx ATTRIBUTE_UNUSED) static void ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED) { - char *name = input_line_pointer; - char c = get_symbol_end (); + char *name; + char c = get_symbol_name (&name); char *p; expressionS exp; symbolS *sym; @@ -2248,7 +2247,7 @@ ppc_elf_localentry (int ignore ATTRIBUTE_UNUSED) p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { *p = 0; @@ -2491,8 +2490,7 @@ parse_toc_entry (enum toc_size_qualifier *toc_kind) SKIP_WHITESPACE (); /* Find the spelling of the operand. */ - toc_spec = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&toc_spec); if (strcmp (toc_spec, "toc") == 0) { @@ -2521,7 +2519,7 @@ parse_toc_entry (enum toc_size_qualifier *toc_kind) /* Now find the ']'. */ *input_line_pointer = c; - SKIP_WHITESPACE (); /* leading whitespace could be there. */ + SKIP_WHITESPACE_AFTER_NAME (); /* leading whitespace could be there. */ c = *input_line_pointer++; /* input_line_pointer->past char in c. */ if (c != ']') @@ -3630,10 +3628,9 @@ ppc_comm (int lcomm) symbolS *sym; char *pfrag; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); end_name = input_line_pointer; - *end_name = endc; + (void) restore_line_pointer (endc); if (*input_line_pointer != ',') { @@ -3684,12 +3681,11 @@ ppc_comm (int lcomm) } ++input_line_pointer; - lcomm_name = input_line_pointer; - lcomm_endc = get_symbol_end (); + lcomm_endc = get_symbol_name (&lcomm_name); lcomm_sym = symbol_find_or_make (lcomm_name); - *input_line_pointer = lcomm_endc; + (void) restore_line_pointer (lcomm_endc); /* The fourth argument to .lcomm is the alignment. */ if (*input_line_pointer != ',') @@ -3792,12 +3788,11 @@ ppc_csect (int ignore ATTRIBUTE_UNUSED) symbolS *sym; offsetT align; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); if (S_GET_NAME (sym)[0] == '\0') { @@ -3965,15 +3960,14 @@ ppc_dwsect (int ignore ATTRIBUTE_UNUSED) /* Parse opt-label. */ if (*input_line_pointer == ',') { - const char *label; + char *label; char c; ++input_line_pointer; - label = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&label); opt_label = symbol_find_or_make (label); - *input_line_pointer = c; + (void) restore_line_pointer (c); } else opt_label = NULL; @@ -4103,8 +4097,7 @@ ppc_named_section (int ignore ATTRIBUTE_UNUSED) char c; symbolS *sym; - user_name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&user_name); if (strcmp (user_name, ".text") == 0) real_name = ".text[PR]"; @@ -4113,12 +4106,12 @@ ppc_named_section (int ignore ATTRIBUTE_UNUSED) else { as_bad (_("the XCOFF file format does not support arbitrary sections")); - *input_line_pointer = c; + (void) restore_line_pointer (c); ignore_rest_of_line (); return; } - *input_line_pointer = c; + (void) restore_line_pointer (c); sym = symbol_find_or_make (real_name); @@ -4135,12 +4128,11 @@ ppc_extern (int ignore ATTRIBUTE_UNUSED) char *name; char endc; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); (void) symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); demand_empty_rest_of_line (); } @@ -4154,12 +4146,11 @@ ppc_lglobl (int ignore ATTRIBUTE_UNUSED) char endc; symbolS *sym; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); symbol_get_tc (sym)->output = 1; @@ -4192,14 +4183,13 @@ ppc_ref (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); 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 (); + SKIP_WHITESPACE_AFTER_NAME (); c = *input_line_pointer; if (c == ',') { @@ -4229,12 +4219,11 @@ ppc_rename (int ignore ATTRIBUTE_UNUSED) symbolS *sym; int len; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); if (*input_line_pointer != ',') { @@ -4393,8 +4382,7 @@ ppc_function (int ignore ATTRIBUTE_UNUSED) symbolS *ext_sym; symbolS *lab_sym; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); /* Ignore any [PR] suffix. */ name = ppc_canonicalize_symbol_name (name); @@ -4405,7 +4393,7 @@ ppc_function (int ignore ATTRIBUTE_UNUSED) ext_sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); if (*input_line_pointer != ',') { @@ -4415,12 +4403,11 @@ ppc_function (int ignore ATTRIBUTE_UNUSED) } ++input_line_pointer; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); lab_sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); if (ext_sym != lab_sym) { @@ -4599,12 +4586,11 @@ ppc_bs (int ignore ATTRIBUTE_UNUSED) if (ppc_current_block != NULL) as_bad (_("nested .bs blocks")); - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); csect = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); sym = symbol_make (".bs"); S_SET_SEGMENT (sym, now_seg); @@ -4881,12 +4867,11 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED) return; } - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); if (S_IS_DEFINED (sym)) { @@ -4952,6 +4937,7 @@ ppc_tc (int ignore ATTRIBUTE_UNUSED) static void ppc_machine (int ignore ATTRIBUTE_UNUSED) { + char c; char *cpu_string; #define MAX_HISTORY 100 static ppc_cpu_t *cpu_history; @@ -4959,19 +4945,9 @@ ppc_machine (int ignore ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); - if (*input_line_pointer == '"') - { - int len; - cpu_string = demand_copy_C_string (&len); - } - else - { - char c; - cpu_string = input_line_pointer; - c = get_symbol_end (); - cpu_string = xstrdup (cpu_string); - *input_line_pointer = c; - } + c = get_symbol_name (&cpu_string); + cpu_string = xstrdup (cpu_string); + (void) restore_line_pointer (c); if (cpu_string != NULL) { @@ -5210,8 +5186,7 @@ ppc_znop (int ignore ATTRIBUTE_UNUSED) char *name; /* Strip out the symbol name. */ - symbol_name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&symbol_name); name = xmalloc (input_line_pointer - symbol_name + 1); strcpy (name, symbol_name); @@ -5220,7 +5195,7 @@ ppc_znop (int ignore ATTRIBUTE_UNUSED) *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* Look up the opcode in the hash table. */ opcode = (const struct powerpc_opcode *) hash_find (ppc_hash, "nop"); @@ -5256,13 +5231,12 @@ ppc_pe_comm (int lcomm) symbolS *symbolP; offsetT align; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { as_bad (_("expected comma after symbol-name: rest of line ignored.")); @@ -5387,15 +5361,14 @@ ppc_pe_section (int ignore ATTRIBUTE_UNUSED) segT sec; int align; - section_name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (§ion_name); name = xmalloc (input_line_pointer - section_name + 1); strcpy (name, section_name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); exp = 0; flags = SEC_NO_FLAGS; @@ -5543,12 +5516,11 @@ ppc_pe_function (int ignore ATTRIBUTE_UNUSED) char endc; symbolS *ext_sym; - name = input_line_pointer; - endc = get_symbol_end (); + endc = get_symbol_name (&name); ext_sym = symbol_find_or_make (name); - *input_line_pointer = endc; + (void) restore_line_pointer (endc); S_SET_DATA_TYPE (ext_sym, DT_FCN << N_BTSHFT); SF_SET_FUNCTION (ext_sym); diff --git a/gas/config/tc-s390.c b/gas/config/tc-s390.c index 3250127..8d459b6 100644 --- a/gas/config/tc-s390.c +++ b/gas/config/tc-s390.c @@ -168,11 +168,11 @@ register_name (expressionS *expressionP) else return FALSE; - c = get_symbol_end (); + c = get_symbol_name (&name); reg_number = reg_name_search (name); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); /* Look to see if it's in the register table. */ if (reg_number >= 0) @@ -1793,10 +1793,9 @@ s390_machine (int ignore ATTRIBUTE_UNUSED) else { char c; - cpu_string = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&cpu_string); cpu_string = xstrdup (cpu_string); - *input_line_pointer = c; + (void) restore_line_pointer (c); } if (cpu_string != NULL) @@ -1848,19 +1847,13 @@ s390_machinemode (int ignore ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); - if (*input_line_pointer == '"') - { - int len; - mode_string = demand_copy_C_string (&len); - } - else - { - char c; - mode_string = input_line_pointer; - c = get_symbol_end (); - mode_string = xstrdup (mode_string); - *input_line_pointer = c; - } + { + char c; + + c = get_symbol_name (&mode_string); + mode_string = xstrdup (mode_string); + (void) restore_line_pointer (c); + } if (mode_string != NULL) { diff --git a/gas/config/tc-score.c b/gas/config/tc-score.c index dd2703f..49ed5f2 100644 --- a/gas/config/tc-score.c +++ b/gas/config/tc-score.c @@ -5619,10 +5619,9 @@ s3_get_symbol (void) char *name; symbolS *p; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = (symbolS *) symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); return p; } @@ -6095,10 +6094,9 @@ s3_s_score_lcomm (int bytes_p) segT bss_seg = bss_section; int needs_align = 0; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); if (name == p) { diff --git a/gas/config/tc-score7.c b/gas/config/tc-score7.c index 19241ba..e8af055 100644 --- a/gas/config/tc-score7.c +++ b/gas/config/tc-score7.c @@ -5471,10 +5471,9 @@ s7_get_symbol (void) char *name; symbolS *p; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = (symbolS *) symbol_find_or_make (name); - *input_line_pointer = c; + (void) restore_line_pointer (c); return p; } @@ -5954,8 +5953,7 @@ s7_s_score_lcomm (int bytes_p) segT bss_seg = bss_section; int needs_align = 0; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; *p = c; @@ -5966,7 +5964,7 @@ s7_s_score_lcomm (int bytes_p) return; } - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); /* Accept an optional comma after the name. The comma used to be required, but Irix 5 cc does not generate it. */ diff --git a/gas/config/tc-sparc.c b/gas/config/tc-sparc.c index edadfb8..6e7a3ef 100644 --- a/gas/config/tc-sparc.c +++ b/gas/config/tc-sparc.c @@ -3975,11 +3975,10 @@ s_reserve (int ignore ATTRIBUTE_UNUSED) int temp; symbolS *symbolP; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { @@ -4117,12 +4116,11 @@ s_common (int ignore ATTRIBUTE_UNUSED) offsetT temp, size; symbolS *symbolP; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',') { as_bad (_("Expected comma after symbol-name")); @@ -4388,7 +4386,7 @@ s_register (int ignore ATTRIBUTE_UNUSED) char c; int reg; int flags; - const char *regname; + char *regname; if (input_line_pointer[0] != '%' || input_line_pointer[1] != 'g' @@ -4402,8 +4400,7 @@ s_register (int ignore ATTRIBUTE_UNUSED) if (*input_line_pointer == '#') { ++input_line_pointer; - regname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (®name); if (strcmp (regname, "scratch") && strcmp (regname, "ignore")) as_bad (_("register syntax is .register %%g[2367],{#scratch|symbolname|#ignore}")); if (regname[0] == 'i') @@ -4413,9 +4410,9 @@ s_register (int ignore ATTRIBUTE_UNUSED) } else { - regname = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (®name); } + if (sparc_arch_size == 64) { if (globals[reg]) @@ -4462,7 +4459,7 @@ s_register (int ignore ATTRIBUTE_UNUSED) } } - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } diff --git a/gas/config/tc-tic4x.c b/gas/config/tc-tic4x.c index c27c8d1..a4ca8b7 100644 --- a/gas/config/tc-tic4x.c +++ b/gas/config/tc-tic4x.c @@ -727,8 +727,7 @@ tic4x_asg (int x ATTRIBUTE_UNUSED) return; } *input_line_pointer++ = '\0'; - name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&name); /* Get terminator. */ tmp = xmalloc (strlen (str) + 1); strcpy (tmp, str); str = tmp; @@ -739,7 +738,7 @@ tic4x_asg (int x ATTRIBUTE_UNUSED) hash_replace (tic4x_asg_hash, name, (void *) str); else hash_insert (tic4x_asg_hash, name, (void *) str); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -759,8 +758,9 @@ tic4x_bss (int x ATTRIBUTE_UNUSED) current_subseg = now_subseg; /* Save current subseg. */ SKIP_WHITESPACE (); - name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&name); /* Get terminator. */ + if (c == '"') + c = * ++ input_line_pointer; if (c != ',') { as_bad (_(".bss size argument missing\n")); @@ -807,11 +807,10 @@ tic4x_globl (int ignore ATTRIBUTE_UNUSED) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); *input_line_pointer = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); S_SET_STORAGE_CLASS (symbolP, C_EXT); S_SET_EXTERNAL (symbolP); if (c == ',') @@ -939,10 +938,9 @@ tic4x_eval (int x ATTRIBUTE_UNUSED) as_bad (_("Symbol missing\n")); return; } - name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&name); /* Get terminator. */ tic4x_insert_sym (name, value); - *input_line_pointer++ = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -967,8 +965,9 @@ tic4x_sect (int x ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); if (*input_line_pointer == '"') input_line_pointer++; - section_name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (§ion_name); /* Get terminator. */ + if (c == '"') + c = * ++ input_line_pointer; input_line_pointer++; /* Skip null symbol terminator. */ name = xmalloc (input_line_pointer - section_name + 1); strcpy (name, section_name); @@ -980,13 +979,16 @@ tic4x_sect (int x ATTRIBUTE_UNUSED) Volker Kuhlmann . */ if (c == ':') { - c = get_symbol_end (); /* Get terminator. */ + char *subname; + c = get_symbol_name (&subname); /* Get terminator. */ + if (c == '"') + c = * ++ input_line_pointer; input_line_pointer++; /* Skip null symbol terminator. */ as_warn (_(".sect: subsection name ignored")); } /* We might still have a '"' to discard, but the character after a - symbol name will be overwritten with a \0 by get_symbol_end() + symbol name will be overwritten with a \0 by get_symbol_name() [VK]. */ if (c == ',') @@ -1014,7 +1016,7 @@ tic4x_sect (int x ATTRIBUTE_UNUSED) bfd_errmsg (bfd_get_error ())); } - /* If the last character overwritten by get_symbol_end() was an + /* If the last character overwritten by get_symbol_name() was an end-of-line, we must restore it or the end of the line will not be recognised and scanning extends into the next line, stopping with an error (blame Volker Kuhlmann @@ -1037,8 +1039,9 @@ tic4x_set (int x ATTRIBUTE_UNUSED) char c; char *name; - name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&name); /* Get terminator. */ + if (c == '"') + c = * ++ input_line_pointer; if (c != ',') { as_bad (_(".set syntax invalid\n")); @@ -1073,8 +1076,9 @@ tic4x_usect (int x ATTRIBUTE_UNUSED) SKIP_WHITESPACE (); if (*input_line_pointer == '"') input_line_pointer++; - section_name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (§ion_name); /* Get terminator. */ + if (c == '"') + c = * ++ input_line_pointer; input_line_pointer++; /* Skip null symbol terminator. */ name = xmalloc (input_line_pointer - section_name + 1); strcpy (name, section_name); @@ -1513,17 +1517,16 @@ tic4x_operand_parse (char *s, tic4x_operand_t *operand) input_line_pointer = s; SKIP_WHITESPACE (); - str = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&str); /* Get terminator. */ new_pointer = input_line_pointer; if (strlen (str) && (entry = hash_find (tic4x_asg_hash, str)) != NULL) { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = (char *) entry; } else { - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = str; } diff --git a/gas/config/tc-tic54x.c b/gas/config/tc-tic54x.c index 5edd045..2637d10 100644 --- a/gas/config/tc-tic54x.c +++ b/gas/config/tc-tic54x.c @@ -351,8 +351,8 @@ tic54x_asg (int x ATTRIBUTE_UNUSED) return; } - name = ++input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + ++input_line_pointer; + c = get_symbol_name (&name); /* Get terminator. */ if (!ISALPHA (*name)) { as_bad (_("symbols assigned with .asg must begin with a letter")); @@ -367,7 +367,7 @@ tic54x_asg (int x ATTRIBUTE_UNUSED) strcpy (tmp, name); name = tmp; subsym_create_or_replace (name, str); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -411,11 +411,10 @@ tic54x_eval (int x ATTRIBUTE_UNUSED) ignore_rest_of_line (); return; } - name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&name); /* Get terminator. */ tmp = xmalloc (strlen (name) + 1); name = strcpy (tmp, name); - *input_line_pointer = c; + (void) restore_line_pointer (c); if (!ISALPHA (*name)) { @@ -471,8 +470,9 @@ tic54x_bss (int x ATTRIBUTE_UNUSED) current_seg = now_seg; /* Save current seg. */ current_subseg = now_subseg; /* Save current subseg. */ - name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ + c = get_symbol_name (&name); /* Get terminator. */ + if (c == '"') + c = * ++ input_line_pointer; if (c != ',') { as_bad (_(".bss size argument missing\n")); @@ -782,8 +782,8 @@ tic54x_endstruct (int is_union) static void tic54x_tag (int ignore ATTRIBUTE_UNUSED) { - char *name = input_line_pointer; - int c = get_symbol_end (); + char *name; + int c = get_symbol_name (&name); struct stag *stag = (struct stag *) hash_find (stag_hash, name); if (!stag) @@ -829,7 +829,7 @@ tic54x_tag (int ignore ATTRIBUTE_UNUSED) if (current_stag != NULL && !current_stag->is_union) abs_section_offset += stag->size; - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); line_label = NULL; } @@ -1109,11 +1109,10 @@ tic54x_global (int type) do { - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = symbol_find_or_make (name); + c = restore_line_pointer (c); - *input_line_pointer = c; S_SET_STORAGE_CLASS (symbolP, C_EXT); if (c == ',') { @@ -1184,13 +1183,14 @@ tic54x_sect (int arg) else { int c; - name = input_line_pointer; - c = get_symbol_end (); + + c = get_symbol_name (&name); len = strlen(name); name = strcpy (xmalloc (len + 10), name); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } + /* Make sure all named initialized sections flagged properly. If we encounter instructions, we'll flag it with SEC_CODE as well. */ strcat (name, ",\"w\"\n"); @@ -1366,17 +1366,14 @@ tic54x_usect (int x ATTRIBUTE_UNUSED) current_seg = now_seg; /* Save current seg. */ current_subseg = now_subseg; /* Save current subseg. */ - if (*input_line_pointer == '"') - input_line_pointer++; - section_name = input_line_pointer; - c = get_symbol_end (); /* Get terminator. */ - input_line_pointer++; /* Skip null symbol terminator. */ + c = get_symbol_name (§ion_name); /* Get terminator. */ name = xmalloc (input_line_pointer - section_name + 1); strcpy (name, section_name); - - if (*input_line_pointer == ',') + c = restore_line_pointer (c); + + if (c == ',') ++input_line_pointer; - else if (c != ',') + else { as_bad (_("Missing size argument")); ignore_rest_of_line (); @@ -2008,17 +2005,17 @@ tic54x_message (int type) static void tic54x_label (int ignored ATTRIBUTE_UNUSED) { - char *name = input_line_pointer; + char *name; symbolS *symbolP; int c; ILLEGAL_WITHIN_STRUCT (); - c = get_symbol_end (); + c = get_symbol_name (&name); symbolP = colon (name); S_SET_STORAGE_CLASS (symbolP, C_STATLAB); - *input_line_pointer = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -2141,12 +2138,12 @@ tic54x_sblock (int ignore ATTRIBUTE_UNUSED) } else { - char *section_name = input_line_pointer; + char *section_name; - c = get_symbol_end (); + c = get_symbol_name (§ion_name); name = xmalloc (strlen (section_name) + 1); strcpy (name, section_name); - *input_line_pointer = c; + (void) restore_line_pointer (c); } seg = bfd_get_section_by_name (stdoutput, name); @@ -2256,12 +2253,11 @@ tic54x_var (int ignore ATTRIBUTE_UNUSED) ignore_rest_of_line (); return; } - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* .var symbols start out with a null string. */ name = strcpy (xmalloc (strlen (name) + 1), name); hash_insert (subsym_hash[macro_level], name, empty); - *input_line_pointer = c; + c = restore_line_pointer (c); if (c == ',') { ++input_line_pointer; @@ -4500,8 +4496,8 @@ subsym_substitute (char *line, int forced) if (forced) ++ptr; - name = input_line_pointer = ptr; - c = get_symbol_end (); + input_line_pointer = ptr; + c = get_symbol_name (&name); /* '?' is not normally part of a symbol, but it IS part of a local label. */ if (c == '?') @@ -4846,7 +4842,7 @@ md_assemble (char *line) int c; input_line_pointer = line; - c = get_symbol_end (); + c = get_symbol_name (&line); if (cpu == VNONE) cpu = V542; diff --git a/gas/config/tc-tic6x.c b/gas/config/tc-tic6x.c index 1dd2e92..64d39be 100644 --- a/gas/config/tc-tic6x.c +++ b/gas/config/tc-tic6x.c @@ -471,17 +471,15 @@ s_tic6x_personalityindex (int ignored ATTRIBUTE_UNUSED) static void s_tic6x_personality (int ignored ATTRIBUTE_UNUSED) { - char *name, *p, c; + char *name, c; tic6x_unwind_info *unwind = tic6x_get_unwind (); if (unwind->personality_routine || unwind->personality_index != -1) as_bad (_("duplicate .personality directive")); - name = input_line_pointer; - c = get_symbol_end (); - p = input_line_pointer; + c = get_symbol_name (&name); unwind->personality_routine = symbol_find_or_make (name); - *p = c; + (void) restore_line_pointer (c); demand_empty_rest_of_line (); } @@ -570,12 +568,11 @@ s_tic6x_scomm (int ignore ATTRIBUTE_UNUSED) offsetT align; int align2; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; - *p = c; + (void) restore_line_pointer (c); SKIP_WHITESPACE (); if (*input_line_pointer != ',') { diff --git a/gas/config/tc-tilegx.c b/gas/config/tc-tilegx.c index efc3856..d1e8967 100644 --- a/gas/config/tc-tilegx.c +++ b/gas/config/tc-tilegx.c @@ -1085,33 +1085,32 @@ tilegx_parse_name (char *name, expressionS *e, char *nextcharP) static void parse_reg_expression (expressionS* expression) { + char *regname; + char terminating_char; + void *pval; + int regno_and_flags; + int regno; + /* Zero everything to make sure we don't miss any flags. */ memset (expression, 0, sizeof *expression); - char* regname = input_line_pointer; - char terminating_char = get_symbol_end (); - - void* pval = hash_find (main_reg_hash, regname); + terminating_char = get_symbol_name (®name); + pval = hash_find (main_reg_hash, regname); if (pval == NULL) - { - as_bad (_("Expected register, got '%s'."), regname); - } + as_bad (_("Expected register, got '%s'."), regname); - int regno_and_flags = (int)(size_t)pval; - int regno = EXTRACT_REGNO(regno_and_flags); + regno_and_flags = (int)(size_t)pval; + regno = EXTRACT_REGNO(regno_and_flags); if ((regno_and_flags & NONCANONICAL_REG_NAME_FLAG) && require_canonical_reg_names) - { - as_warn (_("Found use of non-canonical register name %s; " - "use %s instead."), - regname, - tilegx_register_names[regno]); - } + as_warn (_("Found use of non-canonical register name %s; " + "use %s instead."), + regname, tilegx_register_names[regno]); /* Restore the old character following the register name. */ - *input_line_pointer = terminating_char; + (void) restore_line_pointer (terminating_char); /* Fill in the expression fields to indicate it's a register. */ expression->X_op = O_register; diff --git a/gas/config/tc-tilepro.c b/gas/config/tc-tilepro.c index 7f76de1..e7c7c64 100644 --- a/gas/config/tc-tilepro.c +++ b/gas/config/tc-tilepro.c @@ -980,8 +980,7 @@ parse_reg_expression (expressionS* expression) /* Zero everything to make sure we don't miss any flags. */ memset (expression, 0, sizeof *expression); - char* regname = input_line_pointer; - char terminating_char = get_symbol_end (); + char terminating_char = get_symbol_name (®name); void* pval = hash_find (main_reg_hash, regname); @@ -998,7 +997,7 @@ parse_reg_expression (expressionS* expression) regname, tilepro_register_names[regno]); /* Restore the old character following the register name. */ - *input_line_pointer = terminating_char; + (void) restore_line_pointer (terminating_char); /* Fill in the expression fields to indicate it's a register. */ expression->X_op = O_register; diff --git a/gas/config/tc-v850.c b/gas/config/tc-v850.c index e6f35b8..f42e767 100644 --- a/gas/config/tc-v850.c +++ b/gas/config/tc-v850.c @@ -270,8 +270,7 @@ v850_comm (int area) symbolS *symbolP; int have_align; - name = input_line_pointer; - c = get_symbol_end (); + c = get_symbol_name (&name); /* Just after name is now '\0'. */ p = input_line_pointer; @@ -1005,15 +1004,14 @@ register_name (expressionS *expressionP) char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (pre_defined_registers, REG_NAME_CNT, name, FALSE); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; @@ -1057,14 +1055,13 @@ system_register_name (expressionS *expressionP, char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (system_registers, SYSREG_NAME_CNT, name, accept_numbers); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); if (reg_number < 0 && accept_numbers) @@ -1118,13 +1115,12 @@ cc_name (expressionS *expressionP, char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (cc_names, CC_NAME_CNT, name, accept_numbers); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); if (reg_number < 0 && accept_numbers) @@ -1169,13 +1165,12 @@ float_cc_name (expressionS *expressionP, char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (float_cc_names, FLOAT_CC_NAME_CNT, name, accept_numbers); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); if (reg_number < 0 && accept_numbers) @@ -1220,13 +1215,12 @@ cacheop_name (expressionS * expressionP, char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (cacheop_names, CACHEOP_NAME_CNT, name, accept_numbers); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); if (reg_number < 0 && accept_numbers) @@ -1269,13 +1263,12 @@ prefop_name (expressionS * expressionP, char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (prefop_names, PREFOP_NAME_CNT, name, accept_numbers); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); if (reg_number < 0 && accept_numbers) @@ -1317,15 +1310,14 @@ vector_register_name (expressionS *expressionP) char c; /* Find the spelling of the operand. */ - start = name = input_line_pointer; - - c = get_symbol_end (); + start = input_line_pointer; + c = get_symbol_name (&name); reg_number = reg_name_search (vector_registers, VREG_NAME_CNT, name, FALSE); /* Put back the delimiting char. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); expressionP->X_add_symbol = NULL; expressionP->X_op_symbol = NULL; @@ -2792,18 +2784,19 @@ md_assemble (char *str) else if ((operand->flags & V850_OPERAND_EP) != 0) { char *start = input_line_pointer; - char c = get_symbol_end (); + char *name; + char c = get_symbol_name (&name); - if (strcmp (start, "ep") != 0 && strcmp (start, "r30") != 0) + if (strcmp (name, "ep") != 0 && strcmp (name, "r30") != 0) { /* Put things back the way we found them. */ - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = start; errmsg = _("expected EP register"); goto error; } - *input_line_pointer = c; + (void) restore_line_pointer (c); str = input_line_pointer; input_line_pointer = hold; @@ -2850,6 +2843,7 @@ md_assemble (char *str) else if ((register_name (&ex) && (operand->flags & V850_OPERAND_REG) == 0)) { + char *name; char c; int exists = 0; @@ -2862,12 +2856,12 @@ md_assemble (char *str) input_line_pointer = str; - c = get_symbol_end (); + c = get_symbol_name (&name); - if (symbol_find (str) != NULL) + if (symbol_find (name) != NULL) exists = 1; - *input_line_pointer = c; + (void) restore_line_pointer (c); input_line_pointer = str; expression (&ex); diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index b8b1e7d..d707da8 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -1548,11 +1548,11 @@ xtensa_literal_pseudo (int ignored ATTRIBUTE_UNUSED) frag_align (2, 0, 0); record_alignment (now_seg, 2); - c = get_symbol_end (); + c = get_symbol_name (&base_name); /* Just after name is now '\0'. */ p = input_line_pointer; *p = c; - SKIP_WHITESPACE (); + SKIP_WHITESPACE_AFTER_NAME (); if (*input_line_pointer != ',' && *input_line_pointer != ':') { @@ -1562,11 +1562,11 @@ xtensa_literal_pseudo (int ignored ATTRIBUTE_UNUSED) xtensa_restore_emit_state (&state); return; } - *p = 0; + *p = 0; colon (base_name); - *p = c; + input_line_pointer++; /* skip ',' or ':' */ xtensa_elf_cons (4); diff --git a/gas/config/tc-z80.c b/gas/config/tc-z80.c index 4931a48..87ed179 100644 --- a/gas/config/tc-z80.c +++ b/gas/config/tc-z80.c @@ -332,6 +332,7 @@ z80_start_line_hook (void) /* Check for