mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-02-11 17:10:45 +08:00
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:
parent
f237c71c0d
commit
ec88c1beac
26
preproc.c
26
preproc.c
@ -3742,6 +3742,32 @@ static Token *expand_mmac_params(Token * tline)
|
||||
}
|
||||
delete_Token(t);
|
||||
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 {
|
||||
t = *tail = tline;
|
||||
tline = tline->next;
|
||||
|
Loading…
Reference in New Issue
Block a user