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@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2020-09-04 14:09:37 -07:00
parent a9ed8ced7c
commit ff97eb6f7e

View file

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