summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-07-06 18:48:23 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-07-06 18:48:23 -0700
commitfc30f8c73644f1b02347e0a3b8ef3da53608868c (patch)
tree1bb3861a4e96c3636dfde5b4619cb11c6e24dceb
parent740df430058721a51f149b26df0864d01e24ad82 (diff)
downloadnasm-fc30f8c73644f1b02347e0a3b8ef3da53608868c.tar.gz
preproc: don't handle %+ until the final phase of smacro expansion
Revert to the earlier behavior of not expanding %+ until the final phase of smacro expansion. However, the previous code has: if (expanded && paste_tokens(&thead, true)) { ... which would inhibit paste_tokens() if expanded was false on the first iteration. However, if expand_mmac_params is not expanding %+, then we cannot bypass this expansion. Thus use: pasted = paste_tokens(&thead, true); if (expanded && pasted) { ... instead. This seems to work with both Syslinux and x264 usage, and therefore hopefully should be compatible with earlier versions of NASM. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--preproc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/preproc.c b/preproc.c
index 9a1ca306..8470dff4 100644
--- a/preproc.c
+++ b/preproc.c
@@ -3611,7 +3611,7 @@ static Token *expand_mmac_params(Token * tline)
*tail = NULL;
if (changed)
- paste_tokens(&thead, true);
+ paste_tokens(&thead, false);
return thead;
}
@@ -3638,7 +3638,7 @@ static Token *expand_smacro(Token * tline)
Context *ctx;
const char *mname;
int deadman = DEADMAN_LIMIT;
- bool expanded;
+ bool expanded, pasted;
/*
* Trick: we should avoid changing the start token pointer since it can
@@ -3928,8 +3928,12 @@ again:
* Also we look for %+ tokens and concatenate the tokens before and after
* them (without white spaces in between).
*/
- if (expanded && paste_tokens(&thead, true)) {
- /* If we concatenated something, re-scan the line for macros */
+ pasted = paste_tokens(&thead, true);
+ if (expanded && pasted) {
+ /*
+ * If we concatenated something, *and* we had previously expanded
+ * an actual macro, scan the lines again for macros...
+ */
tline = thead;
goto again;
}