funny_falcon
funny_falcon

Reputation: 427

clang-cl vs new msvc preprocessor

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:

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?

Upvotes: 0

Views: 279

Answers (0)

Related Questions