* expr.c (operand): Handle 08 and 09 in MRI mode.

* macro.c (ISSEP): Remove duplicated `"' character.
 	(get_any_string): Copy some characters for which ISSEP is true:
	';', '>', '(', ')'.  Otherwise we can get in an infinite loop.
	* read.c (s_space): In MRI mode, the expressions stop at the first
	unquoted space.
	(cons_worker): In MRI mode, restore the terminating character at
	the end of the function.
This commit is contained in:
Ian Lance Taylor 1995-09-07 21:54:13 +00:00
parent 535c89f0a5
commit 3dce804d95
4 changed files with 1231 additions and 9 deletions

View File

@ -1,5 +1,14 @@
Thu Sep 7 12:33:58 1995 Ian Lance Taylor <ian@cygnus.com>
* expr.c (operand): Handle 08 and 09 in MRI mode.
* macro.c (ISSEP): Remove duplicated `"' character.
(get_any_string): Copy some characters for which ISSEP is true:
';', '>', '(', ')'. Otherwise we can get in an infinite loop.
* read.c (s_space): In MRI mode, the expressions stop at the first
unquoted space.
(cons_worker): In MRI mode, restore the terminating character at
the end of the function.
* read.c (cons_worker): Don't use #elif; old compilers don't
support it.

View File

@ -561,6 +561,14 @@ operand (expressionP)
c = *input_line_pointer;
switch (c)
{
case '8':
case '9':
if (flag_mri)
{
integer_constant (0, expressionP);
break;
}
/* Fall through. */
default:
default_case:
if (c && strchr (FLT_CHARS, c))
@ -821,6 +829,49 @@ operand (expressionP)
expressionP->X_add_number = 0;
break;
}
else if ((strncasecmp (input_line_pointer, "startof.", 8) == 0
&& ! is_part_of_name (input_line_pointer[8]))
|| (strncasecmp (input_line_pointer, "sizeof.", 7) == 0
&& ! is_part_of_name (input_line_pointer[7])))
{
int start;
start = (input_line_pointer[1] == 't'
|| input_line_pointer[1] == 'T');
input_line_pointer += start ? 8 : 7;
SKIP_WHITESPACE ();
if (*input_line_pointer != '(')
as_bad ("syntax error in .startof. or .sizeof.");
else
{
char *buf;
++input_line_pointer;
SKIP_WHITESPACE ();
name = input_line_pointer;
c = get_symbol_end ();
buf = (char *) xmalloc (strlen (name) + 10);
if (start)
sprintf (buf, ".startof.%s", name);
else
sprintf (buf, ".sizeof.%s", name);
symbolP = symbol_make (buf);
free (buf);
expressionP->X_op = O_symbol;
expressionP->X_add_symbol = symbolP;
expressionP->X_add_number = 0;
*input_line_pointer = c;
SKIP_WHITESPACE ();
if (*input_line_pointer != ')')
as_bad ("syntax error in .startof. or .sizeof.");
else
++input_line_pointer;
}
break;
}
else
{
goto isname;
@ -1016,13 +1067,13 @@ clean_up_expression (expressionP)
#undef __
#define __ O_illegal
static const operatorT op_encoding[256] =
static operatorT op_encoding[256] =
{ /* maps ASCII->operators */
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __,
__, O_bit_or_not, O_bit_not, __, __, O_modulus, O_bit_and, __,
__, O_bit_or_not, __, __, __, O_modulus, O_bit_and, __,
__, __, O_multiply, O_add, __, O_subtract, __, O_divide,
__, __, __, __, __, __, __, __,
__, __, __, __, O_lt, __, O_gt, __,
@ -1097,6 +1148,7 @@ expr_begin ()
op_rank[O_multiply] = 3;
op_rank[O_divide] = 3;
op_rank[O_modulus] = 3;
op_encoding['"'] = O_bit_not;
}
}
@ -1385,7 +1437,10 @@ get_symbol_end ()
{
char c;
while (is_part_of_name (c = *input_line_pointer++))
/* We accept \001 in a name in case this is being called with a
constructed string. */
while (is_part_of_name (c = *input_line_pointer++)
|| c == '\001')
;
*--input_line_pointer = 0;
return (c);

1126
gas/macro.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2030,11 +2030,32 @@ s_space (mult)
expressionS exp;
long temp_fill;
char *p = 0;
char *stop = NULL;
char stopc;
#ifdef md_flush_pending_output
md_flush_pending_output ();
#endif
/* In MRI mode, the operands end at the first unquoted space. */
if (flag_mri)
{
char *s;
int inquote = 0;
for (s = input_line_pointer;
((! is_end_of_line[(unsigned char) *s] && *s != ' ' && *s != '\t')
|| inquote);
s++)
{
if (*s == '\'')
inquote = ! inquote;
}
stop = s;
stopc = *stop;
*stop = '\0';
}
/* Just like .fill, but temp_size = 1 */
expression (&exp);
if (exp.X_op == O_constant)
@ -2049,16 +2070,14 @@ s_space (mult)
if (! flag_mri || repeat < 0)
as_warn (".space repeat count is %s, ignored",
repeat ? "negative" : "zero");
ignore_rest_of_line ();
return;
goto getout;
}
/* If we are in the absolute section, just bump the offset. */
if (now_seg == absolute_section)
{
abs_section_offset += repeat;
demand_empty_rest_of_line ();
return;
goto getout;
}
/* If we are secretly in an MRI common section, then creating
@ -2067,8 +2086,7 @@ s_space (mult)
{
S_SET_VALUE (mri_common_symbol,
S_GET_VALUE (mri_common_symbol) + repeat);
demand_empty_rest_of_line ();
return;
goto getout;
}
if (!need_pass_2)
@ -2105,6 +2123,16 @@ s_space (mult)
{
*p = temp_fill;
}
getout:
if (flag_mri)
{
input_line_pointer = stop;
*stop = stopc;
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}
demand_empty_rest_of_line ();
}
@ -2394,6 +2422,7 @@ cons_worker (nbytes, rva)
int c;
expressionS exp;
char *stop = NULL;
char stopc;
#ifdef md_flush_pending_output
md_flush_pending_output ();
@ -2420,6 +2449,8 @@ cons_worker (nbytes, rva)
inquote = ! inquote;
}
stop = s;
stopc = *stop;
*stop = '\0';
}
c = 0;
@ -2467,6 +2498,7 @@ cons_worker (nbytes, rva)
if (flag_mri)
{
input_line_pointer = stop;
*stop = stopc;
while (! is_end_of_line[(unsigned char) *input_line_pointer])
++input_line_pointer;
}