(integer_constant, floating_constant): Now return void.
This commit is contained in:
parent
b17c891e58
commit
dae92eaba0
1 changed files with 58 additions and 58 deletions
116
gas/expr.c
116
gas/expr.c
|
@ -56,6 +56,7 @@ FLONUM_TYPE generic_floating_point_number =
|
||||||
/* If nonzero, we've been asked to assemble nan, +inf or -inf */
|
/* If nonzero, we've been asked to assemble nan, +inf or -inf */
|
||||||
int generic_floating_point_magic;
|
int generic_floating_point_magic;
|
||||||
|
|
||||||
|
void
|
||||||
floating_constant (expressionP)
|
floating_constant (expressionP)
|
||||||
expressionS *expressionP;
|
expressionS *expressionP;
|
||||||
{
|
{
|
||||||
|
@ -85,40 +86,38 @@ floating_constant (expressionP)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
integer_constant (radix, expressionP)
|
integer_constant (radix, expressionP)
|
||||||
int radix;
|
int radix;
|
||||||
expressionS *expressionP;
|
expressionS *expressionP;
|
||||||
{
|
{
|
||||||
register char *digit_2; /*->2nd digit of number. */
|
char *digit_2; /*->2nd digit of number. */
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
register valueT number; /* offset or (absolute) value */
|
valueT number; /* offset or (absolute) value */
|
||||||
register short int digit; /* value of next digit in current radix */
|
short int digit; /* value of next digit in current radix */
|
||||||
register short int maxdig = 0;/* highest permitted digit value. */
|
short int maxdig = 0;/* highest permitted digit value. */
|
||||||
register int too_many_digits = 0; /* if we see >= this number of */
|
int too_many_digits = 0; /* if we see >= this number of */
|
||||||
register char *name; /* points to name of symbol */
|
char *name; /* points to name of symbol */
|
||||||
register symbolS *symbolP; /* points to symbol */
|
symbolS *symbolP; /* points to symbol */
|
||||||
|
|
||||||
int small; /* true if fits in 32 bits. */
|
int small; /* true if fits in 32 bits. */
|
||||||
extern const char hex_value[]; /* in hex_value.c */
|
extern const char hex_value[]; /* in hex_value.c */
|
||||||
|
|
||||||
/* may be bignum, or may fit in 32 bits. */
|
/* May be bignum, or may fit in 32 bits. */
|
||||||
/*
|
/* Most numbers fit into 32 bits, and we want this case to be fast.
|
||||||
* most numbers fit into 32 bits, and we want this case to be fast.
|
so we pretend it will fit into 32 bits. If, after making up a 32
|
||||||
* so we pretend it will fit into 32 bits. if, after making up a 32
|
bit number, we realise that we have scanned more digits than
|
||||||
* bit number, we realise that we have scanned more digits than
|
comfortably fit into 32 bits, we re-scan the digits coding them
|
||||||
* comfortably fit into 32 bits, we re-scan the digits coding
|
into a bignum. For decimal and octal numbers we are
|
||||||
* them into a bignum. for decimal and octal numbers we are conservative: some
|
conservative: Some numbers may be assumed bignums when in fact
|
||||||
* numbers may be assumed bignums when in fact they do fit into 32 bits.
|
they do fit into 32 bits. Numbers of any radix can have excess
|
||||||
* numbers of any radix can have excess leading zeros: we strive
|
leading zeros: We strive to recognise this and cast them back
|
||||||
* to recognise this and cast them back into 32 bits.
|
into 32 bits. We must check that the bignum really is more than
|
||||||
* we must check that the bignum really is more than 32
|
32 bits, and change it back to a 32-bit number if it fits. The
|
||||||
* bits, and change it back to a 32-bit number if it fits.
|
number we are looking for is expected to be positive, but if it
|
||||||
* the number we are looking for is expected to be positive, but
|
fits into 32 bits as an unsigned number, we let it be a 32-bit
|
||||||
* if it fits into 32 bits as an unsigned number, we let it be a 32-bit
|
number. The cavalier approach is for speed in ordinary cases. */
|
||||||
* number. the cavalier approach is for speed in ordinary cases.
|
|
||||||
*/
|
|
||||||
|
|
||||||
switch (radix)
|
switch (radix)
|
||||||
{
|
{
|
||||||
|
@ -239,8 +238,12 @@ integer_constant (radix, expressionP)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* either not seen or not defined. */
|
{
|
||||||
as_bad ("backw. ref to unknown label \"%d:\", 0 assumed.", number);
|
/* either not seen or not defined. */
|
||||||
|
/* @@ Should print out the original string instead of
|
||||||
|
the parsed number. */
|
||||||
|
as_bad ("backw. ref to unknown label \"%d:\", 0 assumed.",
|
||||||
|
(int) number);
|
||||||
expressionP->X_seg = absolute_section;
|
expressionP->X_seg = absolute_section;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,11 +323,12 @@ integer_constant (radix, expressionP)
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{ /* not a small number */
|
{
|
||||||
|
/* not a small number */
|
||||||
expressionP->X_add_number = number;
|
expressionP->X_add_number = number;
|
||||||
expressionP->X_seg = big_section;
|
expressionP->X_seg = big_section;
|
||||||
input_line_pointer--; /*->char following number. */
|
input_line_pointer--; /*->char following number. */
|
||||||
} /* if (small) */
|
}
|
||||||
} /* integer_constant() */
|
} /* integer_constant() */
|
||||||
|
|
||||||
|
|
||||||
|
@ -345,16 +349,11 @@ integer_constant (radix, expressionP)
|
||||||
|
|
||||||
static segT
|
static segT
|
||||||
operand (expressionP)
|
operand (expressionP)
|
||||||
register expressionS *expressionP;
|
expressionS *expressionP;
|
||||||
{
|
{
|
||||||
register char c;
|
char c;
|
||||||
register symbolS *symbolP; /* points to symbol */
|
symbolS *symbolP; /* points to symbol */
|
||||||
register char *name; /* points to name of symbol */
|
char *name; /* points to name of symbol */
|
||||||
/* invented for humans only, hope */
|
|
||||||
/* optimising compiler flushes it! */
|
|
||||||
register short int radix; /* 2, 8, 10 or 16, 0 when floating */
|
|
||||||
/* 0 means we saw start of a floating- */
|
|
||||||
/* point constant. */
|
|
||||||
|
|
||||||
/* digits, assume it is a bignum. */
|
/* digits, assume it is a bignum. */
|
||||||
|
|
||||||
|
@ -565,7 +564,7 @@ operand (expressionP)
|
||||||
#endif
|
#endif
|
||||||
symbolP = symbol_new (fake,
|
symbolP = symbol_new (fake,
|
||||||
now_seg,
|
now_seg,
|
||||||
(valueT) (obstack_next_free (&frags) - frag_now->fr_literal),
|
(valueT) ((char*)obstack_next_free (&frags) - frag_now->fr_literal),
|
||||||
frag_now);
|
frag_now);
|
||||||
|
|
||||||
expressionP->X_add_number = 0;
|
expressionP->X_add_number = 0;
|
||||||
|
@ -651,7 +650,7 @@ operand (expressionP)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clean_up_expression (expressionP)
|
clean_up_expression (expressionP)
|
||||||
register expressionS *expressionP;
|
expressionS *expressionP;
|
||||||
{
|
{
|
||||||
segT s = expressionP->X_seg;
|
segT s = expressionP->X_seg;
|
||||||
if (s == absent_section
|
if (s == absent_section
|
||||||
|
@ -725,8 +724,8 @@ expr_part (symbol_1_PP, symbol_2_P)
|
||||||
symbolS *symbol_2_P;
|
symbolS *symbol_2_P;
|
||||||
{
|
{
|
||||||
segT return_value;
|
segT return_value;
|
||||||
#ifndef MANY_SEGMENTS
|
|
||||||
#ifndef OBJ_ECOFF
|
#if !defined (BFD_ASSEMBLER) && (defined (OBJ_AOUT) || defined (OBJ_BOUT))
|
||||||
int test = ((*symbol_1_PP) == NULL
|
int test = ((*symbol_1_PP) == NULL
|
||||||
|| (S_GET_SEGMENT (*symbol_1_PP) == text_section)
|
|| (S_GET_SEGMENT (*symbol_1_PP) == text_section)
|
||||||
|| (S_GET_SEGMENT (*symbol_1_PP) == data_section)
|
|| (S_GET_SEGMENT (*symbol_1_PP) == data_section)
|
||||||
|
@ -739,7 +738,6 @@ expr_part (symbol_1_PP, symbol_2_P)
|
||||||
|| (S_GET_SEGMENT (symbol_2_P) == bss_section)
|
|| (S_GET_SEGMENT (symbol_2_P) == bss_section)
|
||||||
|| (!S_IS_DEFINED (symbol_2_P)));
|
|| (!S_IS_DEFINED (symbol_2_P)));
|
||||||
assert (test);
|
assert (test);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
if (*symbol_1_PP)
|
if (*symbol_1_PP)
|
||||||
{
|
{
|
||||||
|
@ -793,8 +791,7 @@ expr_part (symbol_1_PP, symbol_2_P)
|
||||||
return_value = absolute_section;
|
return_value = absolute_section;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef MANY_SEGMENTS
|
#if defined (OBJ_AOUT) && !defined (BFD_ASSEMBLER)
|
||||||
#ifndef OBJ_ECOFF
|
|
||||||
test = (return_value == absolute_section
|
test = (return_value == absolute_section
|
||||||
|| return_value == text_section
|
|| return_value == text_section
|
||||||
|| return_value == data_section
|
|| return_value == data_section
|
||||||
|
@ -802,7 +799,6 @@ expr_part (symbol_1_PP, symbol_2_P)
|
||||||
|| return_value == undefined_section
|
|| return_value == undefined_section
|
||||||
|| return_value == pass1_section);
|
|| return_value == pass1_section);
|
||||||
assert (test);
|
assert (test);
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
know ((*symbol_1_PP) == NULL
|
know ((*symbol_1_PP) == NULL
|
||||||
|| (S_GET_SEGMENT (*symbol_1_PP) == return_value));
|
|| (S_GET_SEGMENT (*symbol_1_PP) == return_value));
|
||||||
|
@ -895,14 +891,14 @@ static const operator_rankT
|
||||||
/* Return resultP->X_seg. */
|
/* Return resultP->X_seg. */
|
||||||
segT
|
segT
|
||||||
expr (rank, resultP)
|
expr (rank, resultP)
|
||||||
register operator_rankT rank; /* Larger # is higher rank. */
|
operator_rankT rank; /* Larger # is higher rank. */
|
||||||
register expressionS *resultP; /* Deliver result here. */
|
expressionS *resultP; /* Deliver result here. */
|
||||||
{
|
{
|
||||||
expressionS right;
|
expressionS right;
|
||||||
register operatorT op_left;
|
operatorT op_left;
|
||||||
register char c_left; /* 1st operator character. */
|
char c_left; /* 1st operator character. */
|
||||||
register operatorT op_right;
|
operatorT op_right;
|
||||||
register char c_right;
|
char c_right;
|
||||||
|
|
||||||
know (rank >= 0);
|
know (rank >= 0);
|
||||||
(void) operand (resultP);
|
(void) operand (resultP);
|
||||||
|
@ -970,7 +966,7 @@ expr (rank, resultP)
|
||||||
* does not cause any further inaccuracy.
|
* does not cause any further inaccuracy.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
register symbolS *symbolP;
|
symbolS *symbolP;
|
||||||
|
|
||||||
right.X_add_number = -right.X_add_number;
|
right.X_add_number = -right.X_add_number;
|
||||||
symbolP = right.X_add_symbol;
|
symbolP = right.X_add_symbol;
|
||||||
|
@ -987,13 +983,14 @@ expr (rank, resultP)
|
||||||
{
|
{
|
||||||
segT seg1;
|
segT seg1;
|
||||||
segT seg2;
|
segT seg2;
|
||||||
#ifndef MANY_SEGMENTS
|
#if 0 /* @@ This rejects stuff in common sections too. Figure out some
|
||||||
#ifndef OBJ_ECOFF
|
reasonable test, and make it clean... */
|
||||||
|
#if !defined (MANY_SEGMENTS) && !defined (OBJ_ECOFF)
|
||||||
know (resultP->X_seg == data_section || resultP->X_seg == text_section || resultP->X_seg == bss_section || resultP->X_seg == undefined_section || resultP->X_seg == diff_section || resultP->X_seg == absolute_section || resultP->X_seg == pass1_section || resultP->X_seg == reg_section);
|
know (resultP->X_seg == data_section || resultP->X_seg == text_section || resultP->X_seg == bss_section || resultP->X_seg == undefined_section || resultP->X_seg == diff_section || resultP->X_seg == absolute_section || resultP->X_seg == pass1_section || resultP->X_seg == reg_section);
|
||||||
|
|
||||||
know (right.X_seg == data_section || right.X_seg == text_section || right.X_seg == bss_section || right.X_seg == undefined_section || right.X_seg == diff_section || right.X_seg == absolute_section || right.X_seg == pass1_section);
|
know (right.X_seg == data_section || right.X_seg == text_section || right.X_seg == bss_section || right.X_seg == undefined_section || right.X_seg == diff_section || right.X_seg == absolute_section || right.X_seg == pass1_section);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif /* 0 */
|
||||||
clean_up_expression (&right);
|
clean_up_expression (&right);
|
||||||
clean_up_expression (resultP);
|
clean_up_expression (resultP);
|
||||||
|
|
||||||
|
@ -1047,7 +1044,8 @@ expr (rank, resultP)
|
||||||
/* Will be absolute_section. */
|
/* Will be absolute_section. */
|
||||||
if (resultP->X_seg != absolute_section || right.X_seg != absolute_section)
|
if (resultP->X_seg != absolute_section || right.X_seg != absolute_section)
|
||||||
{
|
{
|
||||||
as_bad ("Relocation error. Absolute 0 assumed.");
|
as_bad ("Relocation error: Symbolic expressions may only involve");
|
||||||
|
as_bad (" addition and subtraction. Absolute 0 assumed.");
|
||||||
resultP->X_seg = absolute_section;
|
resultP->X_seg = absolute_section;
|
||||||
resultP->X_add_number = 0;
|
resultP->X_add_number = 0;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1064,7 @@ expr (rank, resultP)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
as_warn ("Division by 0. 0 assumed.");
|
as_warn ("Division by 0. Result of 0 substituted.");
|
||||||
resultP->X_add_number = 0;
|
resultP->X_add_number = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1096,6 +1094,8 @@ expr (rank, resultP)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case O_right_shift:
|
case O_right_shift:
|
||||||
|
/* @@ We should distinguish signed versus
|
||||||
|
unsigned here somehow. */
|
||||||
resultP->X_add_number >>= right.X_add_number;
|
resultP->X_add_number >>= right.X_add_number;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ expr (rank, resultP)
|
||||||
char
|
char
|
||||||
get_symbol_end ()
|
get_symbol_end ()
|
||||||
{
|
{
|
||||||
register char c;
|
char c;
|
||||||
|
|
||||||
while (is_part_of_name (c = *input_line_pointer++))
|
while (is_part_of_name (c = *input_line_pointer++))
|
||||||
;
|
;
|
||||||
|
|
Loading…
Add table
Reference in a new issue