diff options
author | Ian Lance Taylor <ian@airs.com> | 1995-08-21 21:05:06 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 1995-08-21 21:05:06 +0000 |
commit | 4026c1222f74d1a3be4c1e7a8c6d18fbf798a912 (patch) | |
tree | 262cff805d36b94cf0dd1973cb76e51e3cd8d688 /gas | |
parent | 9821fda9251251db7010f47aa14cf74deae06341 (diff) | |
download | gdb-4026c1222f74d1a3be4c1e7a8c6d18fbf798a912.zip gdb-4026c1222f74d1a3be4c1e7a8c6d18fbf798a912.tar.gz gdb-4026c1222f74d1a3be4c1e7a8c6d18fbf798a912.tar.bz2 |
* read.c (read_a_source_file): In MRI mode, don't end the
statement inside a quotation.
(s_space): Don't warn about a zero repeat count in MRI mode.
* config/tc-m68k.c (crack_operand): In MRI mode, don't count
parentheses inside quotes.
(md_assemble): In MRI mode, anything after the operands field is a
comment.
(parse_mri_control_operand): Adjust start and stop to remove
spaces.
(s_mri_for): Likewise.
Diffstat (limited to 'gas')
-rw-r--r-- | gas/config/tc-m68k.c | 80 | ||||
-rw-r--r-- | gas/read.c | 10 |
2 files changed, 79 insertions, 11 deletions
diff --git a/gas/config/tc-m68k.c b/gas/config/tc-m68k.c index fe3ee54..8f7dad3 100644 --- a/gas/config/tc-m68k.c +++ b/gas/config/tc-m68k.c @@ -2534,25 +2534,31 @@ crack_operand (str, opP) register int parens; register int c; register char *beg_str; + int inquote = 0; if (!str) { return str; } beg_str = str; - for (parens = 0; *str && (parens > 0 || notend (str)); str++) + for (parens = 0; *str && (parens > 0 || inquote || notend (str)); str++) { - if (*str == '(') - parens++; - else if (*str == ')') + if (! inquote) { - if (!parens) - { /* ERROR */ - opP->error = "Extra )"; - return str; + if (*str == '(') + parens++; + else if (*str == ')') + { + if (!parens) + { /* ERROR */ + opP->error = "Extra )"; + return str; + } + --parens; } - --parens; } + if (flag_mri && *str == '\'') + inquote = ! inquote; } if (!*str && parens) { /* ERROR */ @@ -2781,6 +2787,41 @@ md_assemble (str) int shorts_this_frag; fixS *fixP; + /* In MRI mode, the instruction and operands are separated by a + space. Anything following the operands is a comment. The label + has already been removed. */ + if (flag_mri) + { + char *s; + int fields = 0; + int infield = 0; + int inquote = 0; + + for (s = str; *s != '\0'; s++) + { + if ((*s == ' ' || *s == '\t') && ! inquote) + { + if (infield) + { + ++fields; + if (fields >= 2) + { + *s = '\0'; + break; + } + infield = 0; + } + } + else + { + if (! infield) + infield = 1; + if (*s == '\'') + inquote = ! inquote; + } + } + } + memset ((char *) (&the_ins), '\0', sizeof (the_ins)); m68k_ip (str); er = the_ins.error; @@ -4778,6 +4819,9 @@ parse_mri_control_operand (pcc, leftstart, leftstop, rightstart, rightstop) *leftstart = input_line_pointer; *leftstop = s; + if (*leftstop > *leftstart + && ((*leftstop)[-1] == ' ' || (*leftstop)[-1] == '\t')) + --*leftstop; input_line_pointer = s; if (! parse_mri_condition (pcc)) @@ -4795,6 +4839,9 @@ parse_mri_control_operand (pcc, leftstart, leftstop, rightstart, rightstop) *rightstart = input_line_pointer; *rightstop = s; + if (*rightstop > *rightstart + && ((*rightstop)[-1] == ' ' || (*rightstop)[-1] == '\t')) + --*rightstop; input_line_pointer = s; @@ -5283,6 +5330,7 @@ s_mri_for (qual) FOR.q var = init { TO | DOWNTO } end [ BY by ] DO.e */ + SKIP_WHITESPACE (); varstart = input_line_pointer; /* Look for the '='. */ @@ -5297,6 +5345,9 @@ s_mri_for (qual) } varstop = input_line_pointer; + if (varstop > varstart + && (varstop[-1] == ' ' || varstop[-1] == '\t')) + --varstop; ++input_line_pointer; @@ -5330,7 +5381,11 @@ s_mri_for (qual) ignore_rest_of_line (); return; } + if (initstop > initstart + && (initstop[-1] == ' ' || initstop[-1] == '\t')) + --initstop; + SKIP_WHITESPACE (); endstart = input_line_pointer; /* Look for BY or DO. */ @@ -5362,6 +5417,9 @@ s_mri_for (qual) ignore_rest_of_line (); return; } + if (endstop > endstart + && (endstop[-1] == ' ' || endstop[-1] == '\t')) + --endstop; if (! by) { @@ -5370,6 +5428,7 @@ s_mri_for (qual) } else { + SKIP_WHITESPACE (); bystart = input_line_pointer; /* Look for DO. */ @@ -5392,6 +5451,9 @@ s_mri_for (qual) ignore_rest_of_line (); return; } + if (bystop > bystart + && (bystop[-1] == ' ' || bystop[-1] == '\t')) + --bystop; } if (*input_line_pointer != '.') @@ -683,6 +683,8 @@ read_a_source_file (name) } else { /* machine instruction */ + int inquote = 0; + if (mri_pending_align) { do_align (1, (char *) NULL); @@ -693,11 +695,14 @@ read_a_source_file (name) /* Also: input_line_pointer->`\0` where c was. */ *input_line_pointer = c; while (!is_end_of_line[(unsigned char) *input_line_pointer] + || inquote #ifdef TC_EOL_IN_INSN || TC_EOL_IN_INSN (input_line_pointer) #endif ) { + if (flag_mri && *input_line_pointer == '\'') + inquote = ! inquote; input_line_pointer++; } @@ -2017,8 +2022,9 @@ s_space (mult) repeat *= mult; if (repeat <= 0) { - as_warn (".space repeat count is %s, ignored", - repeat ? "negative" : "zero"); + if (! flag_mri || repeat < 0) + as_warn (".space repeat count is %s, ignored", + repeat ? "negative" : "zero"); ignore_rest_of_line (); return; } |