diff options
author | Alan Modra <amodra@gmail.com> | 2015-08-27 22:50:38 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2015-08-27 23:19:59 +0930 |
commit | 2e57ce7b1422a025a65ad4ef0b1f2f4c214b9eec (patch) | |
tree | 88373fbff0acc2f1684da6efa238d2f5332c41aa /gas/config/tc-fr30.c | |
parent | f5cdf4989e5daff1ca8a500d22cbf2eb0692616e (diff) | |
download | gdb-2e57ce7b1422a025a65ad4ef0b1f2f4c214b9eec.zip gdb-2e57ce7b1422a025a65ad4ef0b1f2f4c214b9eec.tar.gz gdb-2e57ce7b1422a025a65ad4ef0b1f2f4c214b9eec.tar.bz2 |
More fallout from "Allow symbol and label names to be enclosed in double quotes"
Some of the TC_START_LABEL implementations need to adjust the end of
the symbol, when a colon doesn't mean a label definition. That means
they need access to nul_char both the restore the NUL location (it may
be a quote rather than a colon) and to store the new nul_char. Others
need adjusting to step over a potential trailing quote.
PR gas/18581
* config/tc-aarch64.h (TC_START_LABEL): Redefine.
* config/tc-arm.c (tc_start_label_without_colon): Delete params.
Use input_line_pointer directly.
* config/tc-arm.h (TC_START_LABEL): Redefine.
(TC_START_LABEL_WITHOUT_COLON): Redefine.
(tc_start_label_without_colon): Update prototype.
* config/tc-bfin.c (bfin_start_label): Delete ptr param. Check
for NUL instead.
* config/tc-bfin.h (bfin_start_label): Update prototype.
(TC_START_LABEL): Redefine.
* config/tc-d30v.h (TC_START_LABEL): Redefine.
* config/tc-fr30.c (restore_colon): Rewrite.
(fr30_is_colon_insn): Add nul_char param. Return int. Bump
i_l_p over quote. Update restore_colon calls.
* config/tc-fr30.h (TC_START_LABEL): Redefine.
(fr30_is_colon_insn): Update prototype.
* config/tc-m32c.c (restore_colon, m32c_is_colon_insn): As above.
* config/tc-m32c.h (TC_START_LABEL): Redefine.
(m32c_is_colon_insn): Update prototype.
* config/tc-m32r.h (TC_START_LABEL): Redefine.
* config/tc-mep.h (TC_START_LABEL): Redefine.
* config/tc-nds32.h (TC_START_LABEL): Redefine.
* config/tc-tic54x.c (tic54x_start_label): Replace params with
nul_char and next_char. Step over trailing quote.
* config/tc-tic54x.h (TC_START_LABEL_WITHOUT_COLON): Redefine.
(tic54x_start_label): Update prototype.
* read.c (TC_START_LABEL): Redefine. Update invocation.
(TC_START_LABEL_WITHOUT_COLON): Update invocation.
* config/tc-nios2.c (s_nios2_set): Save initial input_line_pointer
and restore if calling s_set. Don't restore delim again.
Diffstat (limited to 'gas/config/tc-fr30.c')
-rw-r--r-- | gas/config/tc-fr30.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/gas/config/tc-fr30.c b/gas/config/tc-fr30.c index 6a6c67f..c6e80e3 100644 --- a/gas/config/tc-fr30.c +++ b/gas/config/tc-fr30.c @@ -324,19 +324,16 @@ md_atof (int type, char * litP, int * sizeP) } /* Worker function for fr30_is_colon_insn(). */ -static char -restore_colon (int advance_i_l_p_by) +static int +restore_colon (char *next_i_l_p, char *nul_char) { - char c; - /* Restore the colon, and advance input_line_pointer to the end of the new symbol. */ - * input_line_pointer = ':'; - input_line_pointer += advance_i_l_p_by; - c = * input_line_pointer; - * input_line_pointer = 0; - - return c; + *input_line_pointer = *nul_char; + input_line_pointer = next_i_l_p; + *nul_char = *next_i_l_p; + *next_i_l_p = 0; + return 1; } /* Determines if the symbol starting at START and ending in @@ -344,13 +341,16 @@ restore_colon (int advance_i_l_p_by) (but which has now been replaced bu a NUL) is in fact an LDI:8, LDI:20, LDI:32, CALL:D. JMP:D, RET:D or Bcc:D instruction. If it is, then it restores the colon, advances INPUT_LINE_POINTER - to the real end of the instruction/symbol, and returns the character - that really terminated the symbol. Otherwise it returns 0. */ -char -fr30_is_colon_insn (char * start) + to the real end of the instruction/symbol, saves the char there to + NUL_CHAR and pokes a NUL, and returns 1. Otherwise it returns 0. */ +int +fr30_is_colon_insn (char *start, char *nul_char) { char * i_l_p = input_line_pointer; + if (*nul_char == '"') + ++i_l_p; + /* Check to see if the symbol parsed so far is 'ldi'. */ if ( (start[0] != 'l' && start[0] != 'L') || (start[1] != 'd' && start[1] != 'D') @@ -384,7 +384,7 @@ fr30_is_colon_insn (char * start) break; if (len == -1) - return restore_colon (1); + return restore_colon (i_l_p + 1, nul_char); } } @@ -394,15 +394,17 @@ fr30_is_colon_insn (char * start) /* Check to see if the text following the colon is '8'. */ if (i_l_p[1] == '8' && (i_l_p[2] == ' ' || i_l_p[2] == '\t')) - return restore_colon (2); + return restore_colon (i_l_p + 2, nul_char); /* Check to see if the text following the colon is '20'. */ - else if (i_l_p[1] == '2' && i_l_p[2] =='0' && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) - return restore_colon (3); + else if (i_l_p[1] == '2' && i_l_p[2] =='0' + && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) + return restore_colon (i_l_p + 3, nul_char); /* Check to see if the text following the colon is '32'. */ - else if (i_l_p[1] == '3' && i_l_p[2] =='2' && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) - return restore_colon (3); + else if (i_l_p[1] == '3' && i_l_p[2] =='2' + && (i_l_p[3] == ' ' || i_l_p[3] == '\t')) + return restore_colon (i_l_p + 3, nul_char); return 0; } |