I wrote C11 code with heavy macro magic.
MSVC has new preprocessor mode, enabled with /Zc:preprocessor . This mode is perfectly compatible with GCC and Clang preprocessor, so it does macro magic well.
But I want to use expression block language extensions as well, which is perfectly supported by clang-cl.exe.
Unfortunatelly, clang-cl.exe immitates old cl.exe preprocessor, and I found no way to switch it to clang native preprocessor or cl.exe /Zc:preprocessor compatible mode.
For example, following code:
- compiled well with clang/gcc (unix or mingw)
- preprocessed right with
cl.exe /Zc:preprocessor, but could not be compilled due to "expression block" - not preprocessed right with
clang-cl.exe(since it immitates cl.exe without new flag), therefore not compilled.
static inline int func(int x) { return x; }
#define get1(...) get1_(__VA_ARGS__)
#define get1_(x, ...) x
#define call(a) ({func(a);})
int main(void)
{
return call(get1(3,4));
}
Could someone suggest the way to convince clang-cl.exe to do preprocessing right?