is_end_of_line fixes.

This commit is contained in:
Alan Modra 2000-06-02 02:52:10 +00:00
parent f0d4cc9e0e
commit b75c0c920f
8 changed files with 57 additions and 37 deletions

View File

@ -1,3 +1,27 @@
2000-06-01 Alan Modra <alan@linuxcare.com.au>
* expr.c (operand): Test is_end_of_line outside switch to catch
line separator chars that are also operators.
(operator): Return O_illegal for line separator chars.
* read.c (is_end_of_line): Use 1 instead of 99. Don't set `;'
entry (or `!' entry for TC_HPPA).
* config/tc-arm.c (my_get_float_expression): Cast to unsigned char
before indexing is_end_of_line. Remove redundant check for '\0'.
(fp_op2): Likewise.
* config/tc-h8500.c (md_assemble): Likewise.
* config/tc-mcore.c (md_assemble): Likewise.
* config/tc-tic30.c (tic30_find_parallel_insn): Likewise.
(md_atof): Likewise
* config/tc-m88k.c (s_bss): Cast to unsigned char before indexing
is_end_of_line.
* config/tc-mcore.c (mcore_cons): Likewise.
(mcore_float_cons): Likewise.
(mcore_stringer): Likewise.
* config/tc-tic30.c (tic30_find_parallel_insn): Likewise.
2000-06-01 Scott Bambrough <scottb@netwinder.org> 2000-06-01 Scott Bambrough <scottb@netwinder.org>
* config/tc-arm.c (do_mrs): Allow SPSR_BIT to be set correctly. * config/tc-arm.c (do_mrs): Allow SPSR_BIT to be set correctly.

View File

@ -2219,7 +2219,7 @@ my_get_float_expression (str)
memset (words, 0, MAX_LITTLENUMS * sizeof (LITTLENUM_TYPE)); memset (words, 0, MAX_LITTLENUMS * sizeof (LITTLENUM_TYPE));
/* Look for a raw floating point number */ /* Look for a raw floating point number */
if ((save_in = atof_ieee (*str, 'x', words)) != NULL if ((save_in = atof_ieee (*str, 'x', words)) != NULL
&& (is_end_of_line [(int)(*save_in)] || *save_in == '\0')) && is_end_of_line [(unsigned char) *save_in])
{ {
for (i = 0; i < NUM_FLOAT_VALS; i++) for (i = 0; i < NUM_FLOAT_VALS; i++)
{ {
@ -2644,7 +2644,7 @@ fp_op2 (str)
char *start = *str; char *start = *str;
*str += strlen (fp_const[i]); *str += strlen (fp_const[i]);
if (is_end_of_line[(int)**str] || **str == '\0') if (is_end_of_line[(unsigned char) **str])
{ {
inst.instruction |= i + 8; inst.instruction |= i + 8;
return SUCCESS; return SUCCESS;

View File

@ -1104,8 +1104,7 @@ DEFUN (md_assemble, (str),
/* find the op code end */ /* find the op code end */
for (op_start = op_end = str; for (op_start = op_end = str;
*op_end && !is_end_of_line[(unsigned char) *op_end] && *op_end != ' ';
!is_end_of_line[*op_end] && *op_end != ' ';
op_end++) op_end++)
{ {
if ( /**op_end != '.' if ( /**op_end != '.'

View File

@ -1311,7 +1311,7 @@ s_bss ()
as_warn (_("Ignoring attempt to re-define symbol %s."), name); as_warn (_("Ignoring attempt to re-define symbol %s."), name);
} }
while (!is_end_of_line[*input_line_pointer]) while (!is_end_of_line[(unsigned char) *input_line_pointer])
{ {
input_line_pointer++; input_line_pointer++;
} }

View File

@ -239,7 +239,7 @@ mcore_cons (nbytes)
int commas = 1; int commas = 1;
/* Count the number of commas on the line. */ /* Count the number of commas on the line. */
while (! is_end_of_line [* ptr]) while (! is_end_of_line [(unsigned char) * ptr])
commas += * ptr ++ == ','; commas += * ptr ++ == ',';
poolspan += nbytes * commas; poolspan += nbytes * commas;
@ -268,7 +268,7 @@ mcore_float_cons (float_type)
#endif #endif
/* Count the number of commas on the line. */ /* Count the number of commas on the line. */
while (! is_end_of_line [* ptr]) while (! is_end_of_line [(unsigned char) * ptr])
commas += * ptr ++ == ','; commas += * ptr ++ == ',';
/* We would like to compute "hex_float (float_type) * commas" /* We would like to compute "hex_float (float_type) * commas"
@ -301,7 +301,7 @@ mcore_stringer (append_zero)
estimate, which is OK, and automatically allows for the estimate, which is OK, and automatically allows for the
appending a zero byte, since the real string(s) is/are appending a zero byte, since the real string(s) is/are
required to be enclosed in double quotes. */ required to be enclosed in double quotes. */
while (! is_end_of_line [* ptr]) while (! is_end_of_line [(unsigned char) * ptr])
ptr ++; ptr ++;
poolspan += ptr - input_line_pointer; poolspan += ptr - input_line_pointer;
@ -975,7 +975,7 @@ md_assemble (str)
/* Find the op code end. */ /* Find the op code end. */
for (op_start = op_end = str; for (op_start = op_end = str;
* op_end && nlen < 20 && !is_end_of_line [*op_end] && *op_end != ' '; nlen < 20 && !is_end_of_line [(unsigned char) *op_end] && *op_end != ' ';
op_end++) op_end++)
{ {
name[nlen] = op_start[nlen]; name[nlen] = op_start[nlen];

View File

@ -1459,7 +1459,7 @@ tic30_find_parallel_insn (current_line, next_line)
char *parallel_insn; char *parallel_insn;
debug ("In tic30_find_parallel_insn()\n"); debug ("In tic30_find_parallel_insn()\n");
while (!is_end_of_line[(int) *next_line]) while (!is_end_of_line[(unsigned char) *next_line])
{ {
if (*next_line == PARALLEL_SEPARATOR && *(next_line + 1) == PARALLEL_SEPARATOR) if (*next_line == PARALLEL_SEPARATOR && *(next_line + 1) == PARALLEL_SEPARATOR)
{ {
@ -1495,7 +1495,7 @@ tic30_find_parallel_insn (current_line, next_line)
int char_ptr = 0; int char_ptr = 0;
char c; char c;
while (!is_end_of_line[(int) (c = *line)] && *line) while (!is_end_of_line[(unsigned char) (c = *line)])
{ {
if (is_opcode_char (c) && search_status == NONE) if (is_opcode_char (c) && search_status == NONE)
{ {
@ -1682,7 +1682,8 @@ md_atof (what_statement_type, literalP, sizeP)
debug ("literal = %s\n", literalP); debug ("literal = %s\n", literalP);
debug ("line = "); debug ("line = ");
token = input_line_pointer; token = input_line_pointer;
while (!is_end_of_line[(unsigned) *input_line_pointer] && (*input_line_pointer) && (*input_line_pointer != ',')) while (!is_end_of_line[(unsigned char) *input_line_pointer]
&& (*input_line_pointer != ','))
{ {
debug ("%c", *input_line_pointer); debug ("%c", *input_line_pointer);
input_line_pointer++; input_line_pointer++;

View File

@ -799,6 +799,9 @@ operand (expressionP)
SKIP_WHITESPACE (); /* leading whitespace is part of operand. */ SKIP_WHITESPACE (); /* leading whitespace is part of operand. */
c = *input_line_pointer++; /* input_line_pointer->past char in c. */ c = *input_line_pointer++; /* input_line_pointer->past char in c. */
if (is_end_of_line[(unsigned char) c])
goto eol;
switch (c) switch (c)
{ {
case '1': case '1':
@ -1166,9 +1169,8 @@ operand (expressionP)
{ {
goto isname; goto isname;
} }
case ',': case ',':
case '\n':
case '\0':
eol: eol:
/* can't imagine any other kind of operand */ /* can't imagine any other kind of operand */
expressionP->X_op = O_absent; expressionP->X_op = O_absent;
@ -1211,8 +1213,6 @@ operand (expressionP)
#ifdef TC_M68K #ifdef TC_M68K
de_fault: de_fault:
#endif #endif
if (is_end_of_line[(unsigned char) c])
goto eol;
if (is_name_beginner (c)) /* here if did not begin with a digit */ if (is_name_beginner (c)) /* here if did not begin with a digit */
{ {
/* /*
@ -1571,6 +1571,9 @@ operator ()
c = *input_line_pointer & 0xff; c = *input_line_pointer & 0xff;
if (is_end_of_line[c])
return O_illegal;
switch (c) switch (c)
{ {
default: default:

View File

@ -146,33 +146,26 @@ char lex_type[256] =
* In: a character. * In: a character.
* Out: 1 if this character ends a line. * Out: 1 if this character ends a line.
*/ */
#define Z_ (0)
char is_end_of_line[256] = char is_end_of_line[256] =
{ {
#ifdef CR_EOL #ifdef CR_EOL
99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, 99, Z_, Z_, /* @abcdefghijklmno */ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, /* @abcdefghijklmno */
#else #else
99, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, 99, Z_, Z_, Z_, Z_, Z_, /* @abcdefghijklmno */ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, /* @abcdefghijklmno */
#endif #endif
Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, Z_, /* */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* */
#ifdef TC_HPPA 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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