llvm-capstone/clang/test/Preprocessor/macro_paste_commaext.c
Justin Bogner 502155aff9 Fix whitespace handling in ## operator
In x ## y, where x and y are regular tokens, whitespace between x and ##
is ignored, and whitespace between ## and y is also ignored. When either
x or y is a function argument, whitespace was preserved, but it should
not be. This patch removes the checks for whitespace before ## and
before y, and in the special case where x is an empty macro argument and
y is a regular token, actively removes whitespace before y.

One existing test is affected by that change, but as clang's output now
matches the standard's requirements and that of GCC, I've tweaked the
testcase.

Patch by Harald van Dijk!

llvm-svn: 200785
2014-02-04 19:18:28 +00:00

14 lines
323 B
C

// RUN: %clang_cc1 %s -E | grep 'V);'
// RUN: %clang_cc1 %s -E | grep 'W, 1, 2);'
// RUN: %clang_cc1 %s -E | grep 'X, 1, 2);'
// RUN: %clang_cc1 %s -E | grep 'Y,);'
// RUN: %clang_cc1 %s -E | grep 'Z,);'
#define debug(format, ...) format, ## __VA_ARGS__)
debug(V);
debug(W, 1, 2);
debug(X, 1, 2 );
debug(Y, );
debug(Z,);