At the end of its expand_mmac_params()
function the preprocessor concatenates
successive TOK_WHITESPACE tokens into
a single TOK_WHITESPACE token.
However, instead of concatenating the
actual text of both tokens, the text
of the second token is discarded.
For example:
%macro m 0-1+ ; call to perform
%1 ; TOK_WHITESPACE
%endmacro ; concatenation
%push c
%define %$d ; expands into nothing
%define %$q '
db %$q%$d %$d %$d%$q ; 2x " "
m db %$q%$d %$d %$d%$q ; 1x " "
db %$q%$d %$d %$d %$d%$q ; 3x " "
m db %$q%$d %$d %$d %$d%$q ; 2x " "
%pop
This should be fixed.
Logged In: YES
user_id=804543
The following diff would solve the problem, if it
weren't for SF bug #833425. (Said bug causes the
nasm_strcat() to fail, due to t->text and tt->text
being NULL, instead of pointers to strings which
contain the actual isspace() characters).
--- preproc.c.0.98.38
+++ preproc.c.fixed
@@ -3303,6 +3303,9 @@
case TOK_WHITESPACE:
if (tt->type == TOK_WHITESPACE)
{
+ char *tmp = nasm_strcat(t->text,
tt->text);
+ nasm_free(t->text);
+ t->text = tmp;
t->next = delete_Token(tt);
}
break;