[cfe-commits] [PATCH] Fixing include order for Windows

Nico Weber thakis at chromium.org
Sun Feb 19 22:17:05 PST 2012


Hi Aaron,

clang trunk can parse <map> from msvc2010 without problems as is:

C:\src\chrome\src>type test.cc
#include <map>

C:\src\chrome\src>..\..\llvm-build\bin\Release\clang++ -fsyntax-only test.cc

C:\src\chrome\src>

(^ note no error output)

What problems are you seeing?

Nico

On Sun, Feb 19, 2012 at 10:28 AM, Aaron Ballman <aaron at aaronballman.com> wrote:
> On Windows, the default search paths for includes would put the
> CMake-found headers (<build dir>\lib\clang\3.1\include) before the OS
> headers.  For the most part, this is fine.  However, there are some
> header files that share names with the system headers, which are
> incorrect.  For instance, immintrin.h is completely different from the
> SDK include.  This causes miscompilations in surprising places because
> a system header will attempt to include one of these duplicates, and
> find the clang header instead of the other system header.
>
> A simple test case of: #include <map> when building from MSVC
> demonstrates the issue.
>
> A user can work around this behavior by specifying -nobuiltininc on
> the command line, but that seems rather obtuse for such normal use
> cases.
>
> I've fixed this by changing the order that the headers are included
> from the toolchain.  The SDK headers get added *before* the clang
> headers, and this resolves the issue.
>
> This patch does cause one regression test to fail
> (Modules\compiler_builtins.m).  This is because the platform SDK
> intrinsics are differently structured from the ones that come with
> clang.  The OS APIs expect the SDK intrinsics, but our tests seem to
> require our own intrinsics.  I'm open to suggestions.
>
> Thanks!
>
> ~Aaron
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>




More information about the cfe-commits mailing list