From: Dale Weiler Date: Tue, 8 Apr 2014 08:02:23 +0000 (-0400) Subject: Only increment the buffer location for macro output whitespace stripping if the situa... X-Git-Tag: xonotic-v0.8.0~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=0db41f4279a72ed05f93a047baae53a159e23511;p=xonotic%2Fgmqcc.git 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. --- 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);