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

Ruben Van Boxem vanboxem.ruben at gmail.com
Sun Oct 23 03:28:15 PDT 2011


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
#define NULL ((void*)0)

This makes absolutely no sense, and makes NULL unusable:

In file included from C:\Program Files\Microsoft
In file included from C:\Program Files\Microsoft
C:\Program Files\Microsoft SDKs\Windows\v7.1\\include\winnt.h:14781:33:
      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.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111023/d10f758e/attachment.html>

More information about the cfe-dev mailing list