summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2010-06-02 00:59:21 +0400
committerCyrill Gorcunov <gorcunov@gmail.com>2010-06-02 01:05:37 +0400
commitec88c1beac003bd6660037da3cef3aebeee7af20 (patch)
tree518631d362e7c320af707054b84bf58da21a1ccd
parentf237c71c0d5b2c88c3a65184ab209c9aea379eec (diff)
downloadnasm-ec88c1beac003bd6660037da3cef3aebeee7af20.tar.gz
nasm-ec88c1beac003bd6660037da3cef3aebeee7af20.tar.bz2
nasm-ec88c1beac003bd6660037da3cef3aebeee7af20.zip
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>
-rw-r--r--preproc.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/preproc.c b/preproc.c
index ac6c1f9..86366ed 100644
--- a/preproc.c
+++ b/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;