forked from aniani/nasm
BR3005117: Expland local single macro before pasting tokens
When we have switched to unified token pasting code we loose backward compatibility. Restore it. Note that new code MUST not expluatate this facility but rather use paste macro %+ explicitly. N.B. this patch is probably the candidate for revert, though to give it a chance I commit it. Reported-by: Alexey Dokuchaev Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
26
preproc.c
26
preproc.c
@@ -3742,6 +3742,32 @@ static Token *expand_mmac_params(Token * tline)
|
|||||||
}
|
}
|
||||||
delete_Token(t);
|
delete_Token(t);
|
||||||
changed = true;
|
changed = true;
|
||||||
|
} else if (tline->type == TOK_PREPROC_ID &&
|
||||||
|
tline->text[0] == '%' && tline->text[1] == '$' &&
|
||||||
|
(tok_type_(tline->next, TOK_ID) ||
|
||||||
|
tok_type_(tline->next, TOK_PREPROC_ID) ||
|
||||||
|
tok_type_(tline->next, TOK_NUMBER) ||
|
||||||
|
tok_type_(tline->next, TOK_FLOAT))) {
|
||||||
|
/*
|
||||||
|
* In a sake of backward compatibility we allow
|
||||||
|
* to expand local single macro that early before
|
||||||
|
* pasting token code have place
|
||||||
|
*
|
||||||
|
* NOTE: that new code MUST use %+ macro to obtain
|
||||||
|
* same result
|
||||||
|
*/
|
||||||
|
t = tline;
|
||||||
|
tline = tline->next;
|
||||||
|
tt = tokenize(t->text);
|
||||||
|
tt = expand_smacro(tt);
|
||||||
|
*tail = tt;
|
||||||
|
while (tt) {
|
||||||
|
tt->a.mac = NULL;
|
||||||
|
tail = &tt->next;
|
||||||
|
tt = tt->next;
|
||||||
|
}
|
||||||
|
delete_Token(t);
|
||||||
|
changed = true;
|
||||||
} else {
|
} else {
|
||||||
t = *tail = tline;
|
t = *tail = tline;
|
||||||
tline = tline->next;
|
tline = tline->next;
|
||||||
|
Reference in New Issue
Block a user