[nasm:master] preproc: don't loop on a variable that doesn't advance
nasm-bot for H. Peter Anvin (Intel)
hpa at zytor.com
Fri Sep 4 14:12:13 PDT 2020
Commit-ID: ff97eb6f7e716155c6afe6ffa961892660114165
Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ff97eb6f7e716155c6afe6ffa961892660114165
Author: H. Peter Anvin (Intel) <hpa at zytor.com>
AuthorDate: Fri, 4 Sep 2020 14:09:37 -0700
Committer: H. Peter Anvin (Intel) <hpa at zytor.com>
CommitDate: Fri, 4 Sep 2020 14:09:37 -0700
preproc: don't loop on a variable that doesn't advance
When pasting and stripping %+ and whitespace tokens, we either need to
set *nextp in the loop, or treat next as a separate variable and
update *nextp after the loop finishes. This implements the second
option.
This fixes travis test "amx".
Signed-off-by: H. Peter Anvin (Intel) <hpa at zytor.com>
---
asm/preproc.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/asm/preproc.c b/asm/preproc.c
index fbb0378b..b8fb6d23 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -4985,12 +4985,14 @@ static bool paste_tokens(Token **head, const struct concat_mask *m,
* we can end up having multiple %+ tokens in a row;
* just drop whem in that case.
*/
- while ((next = *nextp)) {
+ next = *nextp;
+ while (next) {
if (next->type == TOKEN_PASTE || next->type == TOKEN_WHITESPACE)
next = delete_Token(next);
else
break;
}
+ *nextp = next;
/*
* Nothing after? Just leave the existing token.
More information about the Nasm-commits
mailing list