preproc: fix more token pasting cases

"+" can be a separate token that ends up having to get pulled into the
middle of a floating-point constant.  It's not even that strange.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2009-04-08 14:02:25 -07:00
parent 93f77ac51a
commit 6125b62403
2 changed files with 18 additions and 1 deletions

View File

@ -3327,6 +3327,7 @@ static int find_cc(Token * t)
static Token *expand_mmac_params(Token * tline)
{
Token *t, *tt, **tail, *thead;
bool changed = false;
tail = &thead;
thead = NULL;
@ -3443,6 +3444,7 @@ static Token *expand_mmac_params(Token * tline)
t->text = text;
t->a.mac = NULL;
}
changed = true;
continue;
} else if (tline->type == TOK_INDIRECT) {
t = tline;
@ -3457,6 +3459,7 @@ static Token *expand_mmac_params(Token * tline)
tt = tt->next;
}
delete_Token(t);
changed = true;
} else {
t = *tail = tline;
tline = tline->next;
@ -3466,6 +3469,9 @@ static Token *expand_mmac_params(Token * tline)
}
*tail = NULL;
if (!changed)
return thead;
/* Now handle token pasting... */
tail = &thead;
while ((t = *tail) && (tt = t->next)) {
@ -3486,7 +3492,7 @@ static Token *expand_mmac_params(Token * tline)
while (tt &&
(tt->type == TOK_ID || tt->type == TOK_NUMBER ||
tt->type == TOK_FLOAT)) {
tt->type == TOK_FLOAT || tt->type == TOK_OTHER)) {
len += strlen(tt->text);
tt = tt->next;
}

View File

@ -12,3 +12,14 @@
%endmacro
dx foo, bar
%macro df 2
%assign xy __float32__(%1e+%2)
dd xy
dd %1e+%2
%endmacro
df 1, 36
df 33, 20
df 0, 2
df 1.2, 5