When dumping the macros, two special cases are needed regarding whitespace: * just before the macro body * just after the macro body. This is caused in parts because some misunderstanding about the role of TOKEN_UNTAINT. Happily, things can be simplified, which is what is done in this patch. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- pre-process.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/pre-process.c b/pre-process.c index 1b3fdc2f9..f5b25d54d 100644 --- a/pre-process.c +++ b/pre-process.c @@ -2197,14 +2197,15 @@ static void dump_macro(struct symbol *sym) } putchar(')'); } - putchar(' '); token = sym->expansion; while (token_type(token) != TOKEN_UNTAINT) { struct token *next = token->next; + if (token->pos.whitespace) + putchar(' '); switch (token_type(token)) { case TOKEN_CONCAT: - printf("## "); + printf("##"); break; case TOKEN_STR_ARGUMENT: printf("#"); @@ -2215,10 +2216,6 @@ static void dump_macro(struct symbol *sym) /* fall-through */ default: printf("%s", show_token(token)); - if (token_type(next) == TOKEN_UNTAINT) - break; - if (next->pos.whitespace) - putchar(' '); } token = next; } -- 2.19.0