aboutsummaryrefslogtreecommitdiff
path: root/gas/config/tc-mn10300.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2015-08-21 16:42:14 +0100
committerNick Clifton <nickc@redhat.com>2015-08-21 16:42:14 +0100
commitd02603dc201f80cd9d2a1f4b1a16110b1e04222b (patch)
treeb55476923d8bde556b6b3421345bde8e4562ad97 /gas/config/tc-mn10300.c
parent40045d91812b25c88c8275b8c08d27c234b68ba8 (diff)
downloadgdb-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-mn10300.c')
-rw-r--r--gas/config/tc-mn10300.c103
1 files changed, 52 insertions, 51 deletions
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
{