From 0db41f4279a72ed05f93a047baae53a159e23511 Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Tue, 8 Apr 2014 04:02:23 -0400 Subject: [PATCH] Only increment the buffer location for macro output whitespace stripping if the situation is actually stripable, otherwise macros like #define foo(X) bar(#X), with foo(test) will expand to bartest) instead of bar(test). This should fix Xonotic builds. --- ftepp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ftepp.c b/ftepp.c index c1052de..b974f4f 100644 --- a/ftepp.c +++ b/ftepp.c @@ -849,10 +849,11 @@ static bool ftepp_macro_expand(ftepp_t *ftepp, ppmacro *macro, macroparam *param break; default: buffer = out->value; - if (vec_size(macro->output) > o + 1 && macro->output[o+1]->token == '#') + #define buffer_stripable(X) ((X) == ' ' || (X) == '\t') + if (vec_size(macro->output) > o + 1 && macro->output[o+1]->token == '#' && buffer_stripable(*buffer)) buffer++; if (strip) { - while (*buffer == ' ' || *buffer == '\t') buffer++; + while (buffer_stripable(*buffer)) buffer++; strip = false; } ftepp_out(ftepp, buffer, false); -- 2.39.2