[cfe-commits] r140009 - lib/Frontend/CompilerInvocation.cpp

Francois Pichet pichet2000 at gmail.com
Wed Oct 5 14:52:29 PDT 2011

On Wed, Oct 5, 2011 at 1:58 PM, Bob Wilson <bob.wilson at apple.com> wrote:
> Francois,
> I just noticed this change:
> r140009 | fpichet | 2011-09-18 22:15:54 -0700 (Sun, 18 Sep 2011) | 1 line
> Do not use builtin includes if -fms-compatibility is specified. Some MSVC header files have the same name as clang's builtins, this creates clash.
> Are you sure this is the right thing to do?  If none of the clang-specific header files are available, that means that things like the AVX/SSE intrinsics will not be available.  What about clang's version of tgmath.h?  Etc.  What MSVC header files caused a clash and what was the problem with that clash?
The problem is:
using clang compiled with MSVC 2010
given test.cpp:
#include <vector>

C:\dev\llvm\test>clang test5.cpp
In file included from test5.cpp:1:
In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\inc
In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\inc
In file included from C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\inc
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\ammintrin.h:222:1
: error:
      unknown type name '__m256'
__m256 _mm256_macc_ps(__m256, __m256, __m256);
a flooding of errors

That is because ammintrin.h includes some headers existing on MSVC and
clang include's builtins directory. When compiling MSVC headers you
really want clang to pick the MSVC headers otherwise it won't work.

That's why I disabled clang intrinsic if -fms-compatibility is
specified. I created option fms-compatibility just a few weeks ago to
deal with cases like that. The intent is for -fms-compatibility to be
used in the context of using clang for MSVC emulation. Since clang
builtins don't exist on MSVC I don't see the problem.

There is another option -fms-extensions that doesn't disable
builtininc and allow some microsoft extensions.

Is that a problem for you?

More information about the cfe-commits mailing list