[cfe-dev] clang 'emulating' VC++ on Windows predefined macros

Edward Diener via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 28 08:32:04 PDT 2016


On 3/28/2016 10:00 AM, Yaron Keren via cfe-dev wrote:
> Both __clang__ and _MSC_VER would be defined for clang-cl. In this mode
> you are more likely to use clang or gcc-compatible features rather than
> the VC bugs/workarounds, not all of which are emulated by clang-cl.

To what is _MSC_VER set when clang-cl is used ?

Does clang when using the -fms-compatibility or -fms-extensions flags 
implement the 'emulated' VC++ non-standard preprocessor ? If so are both 
__clang__ and _MSC_VER defined when that happens ?

For my purposes I am only concerned with detecting, at preprocessing 
time, clang 'emulating' the non-standard VC++ preprocessor. I understand 
that there are other C++ issues in this emulation of VC++, such as those 
you have reported below.

>
> Some examples from the last time I tried using Boost with clang-cl :
>
> https://svn.boost.org/trac/boost/ticket/11821
> https://svn.boost.org/trac/boost/ticket/11832
>
>
> 2016-03-28 14:43 GMT+03:00 Edward Diener via cfe-dev
> <cfe-dev at lists.llvm.org
> <mailto:cfe-dev at lists.llvm.org>>:
>
>     There is a build of clang which 'emulates' VC++ including the
>     non-standard VC++ preprocessor. How can I tell, via preprocessor
>     defines, when this occurs in preprocessor code ?
>
>     I am the author of Boost VMD and a maintainer of Boost PP and I need
>     to set internal macros in both, when the non-standard VC++
>     preprocessor is being used, so that the VC++ workarounds which allow
>     both libraries to work with VC++ are in effect.




More information about the cfe-dev mailing list