From 6125b624037a73f621295ff8bce0baffe9cb57ee Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Wed, 8 Apr 2009 14:02:25 -0700 Subject: [PATCH] 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 --- preproc.c | 8 +++++++- test/weirdpaste.asm | 11 +++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/preproc.c b/preproc.c index fd621f51..45ef1f64 100644 --- a/preproc.c +++ b/preproc.c @@ -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; } diff --git a/test/weirdpaste.asm b/test/weirdpaste.asm index c6e98150..529298ba 100644 --- a/test/weirdpaste.asm +++ b/test/weirdpaste.asm @@ -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 -- 2.11.4.GIT