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:
Cyrill Gorcunov 2010-06-02 00:59:21 +04:00
parent f237c71c0d
commit ec88c1beac

View file

@ -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;