diff options
author | Nick Clifton <nickc@redhat.com> | 2015-08-21 16:42:14 +0100 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2015-08-21 16:42:14 +0100 |
commit | d02603dc201f80cd9d2a1f4b1a16110b1e04222b (patch) | |
tree | b55476923d8bde556b6b3421345bde8e4562ad97 /gas/config/tc-tic4x.c | |
parent | 40045d91812b25c88c8275b8c08d27c234b68ba8 (diff) | |
download | gdb-d02603dc201f80cd9d2a1f4b1a16110b1e04222b.zip gdb-d02603dc201f80cd9d2a1f4b1a16110b1e04222b.tar.gz gdb-d02603dc201f80cd9d2a1f4b1a16110b1e04222b.tar.bz2 |
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.
Diffstat (limited to 'gas/config/tc-tic4x.c')
-rw-r--r-- | gas/config/tc-tic4x.c | 51 |
1 files changed, 27 insertions, 24 deletions
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 <v.kuhlmann@elec.canterbury.ac.nz>. */ 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 <v.kuhlmann@elec.canterbury.ac.nz> @@ -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; } |