From 8287daf2a4ea198c6034d37f832036a5f49d695d Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 7 Jul 2009 16:00:58 -0700 Subject: [PATCH] preproc: always reprocess smacros after %+ - pasting We always need to process %+ at least once, but we also always need to reprocess smacros after pasting. The solution to this is to make sure we always reprocess %+ after the first expansion pass. Signed-off-by: H. Peter Anvin --- preproc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/preproc.c b/preproc.c index 8470dff4..ab24953a 100644 --- a/preproc.c +++ b/preproc.c @@ -3638,7 +3638,7 @@ static Token *expand_smacro(Token * tline) Context *ctx; const char *mname; int deadman = DEADMAN_LIMIT; - bool expanded, pasted; + bool expanded; /* * Trick: we should avoid changing the start token pointer since it can @@ -3655,10 +3655,11 @@ static Token *expand_smacro(Token * tline) org_tline->text = NULL; } + expanded = true; /* Always expand %+ at least once */ + again: tail = &thead; thead = NULL; - expanded = false; while (tline) { /* main token loop */ if (!--deadman) { @@ -3928,13 +3929,13 @@ again: * Also we look for %+ tokens and concatenate the tokens before and after * them (without white spaces in between). */ - pasted = paste_tokens(&thead, true); - if (expanded && pasted) { + if (expanded && paste_tokens(&thead, true)) { /* * If we concatenated something, *and* we had previously expanded * an actual macro, scan the lines again for macros... */ tline = thead; + expanded = false; goto again; } -- 2.11.4.GIT