Clang and MSVC (10) headers

Hi,

In an attempt to bypass a buggy C++11 implementation in MSVC10, I am trying to build and patch libc++ to work with MSVC built Clang.

What are the plans to support MSVC system headers in Clang’s internal headers? Can I “ignore” them when using MSVC-built Clang? The problem is this bit about NULL (and other things, most probably) in Clang’s stddef.h:

#undef NULL
#ifdef __cplusplus
#undef __null // VC++ hack.
#define NULL __null
#else
#define NULL ((void*)0)
#endif

This makes absolutely no sense, and makes NULL unusable:

In file included from C:\Program Files\Microsoft SDKs\Windows\v7.1\include\windows.h:155:
In file included from C:\Program Files\Microsoft SDKs\Windows\v7.1\include\windef.h:177:
C:\Program Files\Microsoft SDKs\Windows\v7.1\include\winnt.h:14781:33: error:
expected expression
CallbackEnviron->Pool = NULL;
^

This is in a MSVC header, so the fix has to come from Clang side. (either I add ifndef _MSC_VER to every Clang header that conflicts, or some special steps need to be taken to ensure these conflicts are removed). I can go either way.

A second thing: on Windows, header search should be case insensitive, Microsoft likes calling windows.h Windows.h and other nice random capitalization in other headers. MinGW has plain windows.h, so the header search really needs to be case insensitive here.

Thanks!

Ruben

Hi,

In an attempt to bypass a buggy C++11 implementation in MSVC10, I am trying
to build and patch libc++ to work with MSVC built Clang.

What are the plans to support MSVC system headers in Clang's internal
headers? Can I "ignore" them when using MSVC-built Clang? The problem is
this bit about NULL (and other things, most probably) in Clang's stddef.h:

#undef NULL
#ifdef __cplusplus
#undef __null // VC++ hack.
#define NULL __null
#else
#define NULL ((void*)0)
#endif

This makes absolutely no sense, and makes NULL unusable:

It makes perfect sense to me... we want NULL to expand to __null.
Perhaps the VC++ hack isn't quite right (maybe we need to #define
__null __null?).

A second thing: on Windows, header search should be case insensitive,
Microsoft likes calling windows.h Windows.h and other nice random
capitalization in other headers. MinGW has plain windows.h, so the header
search really needs to be case insensitive here.

Yes, it should.

It's worth noting that a clang-built libc++ won't work with with MSVC,
and vice versa... clang's current MS C++ ABI implementation is
essentially unusable.

-Eli