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.

This commit is contained in:
Dale Weiler 2014-04-08 04:02:23 -04:00
parent 15d1277158
commit 0db41f4279

View file

@ -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);