mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
BR3392200: preproc - Fix dangling paste term
In case if there a production {tok},{%+},{whitespace}* the preprocessor does not delete ending paste+spaces tokens. Fix it. http://bugzilla.nasm.us/show_bug.cgi?id=3392200 Reported-by: KO Myung-Hun <komh@chollian.net> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
12
preproc.c
12
preproc.c
@@ -4026,6 +4026,9 @@ static bool paste_tokens(Token **head, const struct tokseq_match *m,
|
|||||||
char *tmp;
|
char *tmp;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
nasm_dump_stream(*head);
|
||||||
|
nasm_dump_token(*head);
|
||||||
|
|
||||||
/* Now handle token pasting... */
|
/* Now handle token pasting... */
|
||||||
paste_head = NULL;
|
paste_head = NULL;
|
||||||
tail = head;
|
tail = head;
|
||||||
@@ -4046,8 +4049,13 @@ static bool paste_tokens(Token **head, const struct tokseq_match *m,
|
|||||||
while (t && (t->type == TOK_WHITESPACE ||
|
while (t && (t->type == TOK_WHITESPACE ||
|
||||||
t->type == TOK_PASTE))
|
t->type == TOK_PASTE))
|
||||||
t = *tail = delete_Token(t);
|
t = *tail = delete_Token(t);
|
||||||
if (!paste_head || !t)
|
if (!t) { /* Dangling %+ term */
|
||||||
break; /* Nothing to paste with */
|
if (paste_head)
|
||||||
|
(*paste_head)->next = NULL;
|
||||||
|
else
|
||||||
|
*head = NULL;
|
||||||
|
return did_paste;
|
||||||
|
}
|
||||||
tail = paste_head;
|
tail = paste_head;
|
||||||
t = *tail;
|
t = *tail;
|
||||||
tt = t->next;
|
tt = t->next;
|
||||||
|
Reference in New Issue
Block a user