[cfe-dev] Clang and MSVC (10) headers

Eli Friedman eli.friedman at gmail.com
Sun Oct 23 15:10:43 PDT 2011

On Sun, Oct 23, 2011 at 3:28 AM, Ruben Van Boxem
<vanboxem.ruben at gmail.com> wrote:
> 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.


More information about the cfe-dev mailing list