[cfe-dev] Fwd: clang-cl and INCLUDE path ordering

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Fri Aug 19 07:56:25 PDT 2016


I don't think we can change the ordering because VC/include is typically
included in the INCLUDE environment variable, and that directory contains
MSVC's *mmintrin.h headers, which are compiler-specific. We need clang's
intrinsic headers to win out over MSVC's. It sounds like you can work
around the issue by passing /I., though, right?

Thanks for the report, though, always excited to hear about new user
experiences. :)

On Fri, Aug 19, 2016 at 5:09 AM, Jay Foad via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi,
>
> I ran into a problem when switching from cl.exe to clang-cl.exe (3.8.1)
> for building a large proprietary Windows application. I'm not sure if this
> counts as a bug in clang-cl, but I thought I should report it anyway.
>
> Our app:
> - has its own header called cpuid.h
> - for obscure reasons, includes all its own headers using angle brackets
> instead of double quotes: #include <cpuid.h>
>
> The problem goes like this:
>
> $ cat foo.c
> #include <cpuid.h>
> T x;
>
> $ cat cpuid.h
> typedef int T;
>
> $ INCLUDE=. cl /c foo.c # works
>
> $ INCLUDE=. clang-cl /c foo.c # doesn't work
> foo.c(2,1) :  error: unknown type name 'T'
>
> ... because it has picked up the cpuid.h shipped with clang-cl, not the
> one in the current directory.
>
> A few experiments with cl suggest that it looks for headers in these
> directories, in this order:
> 1. /I command line options
> 2. INCLUDE environment variable
> 3. C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include
>
> Whereas clang-cl -Xclang -v tells me it is looking in:
> 1. /I command line options
> 2. C:\Program Files\LLVM\bin\..\lib\clang\3.8.1\include
> 3. INCLUDE environment variable
>
> Any chance of swapping 2 and 3 round, to better match cl?
>
> Thanks,
> Jay.
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160819/d72a77b0/attachment.html>


More information about the cfe-dev mailing list