[cfe-dev] Emulation of VC++ preprocessor

Reid Kleckner via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 28 13:58:22 PDT 2016


On Mon, Mar 28, 2016 at 12:43 PM, Edward Diener via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Does the clang emulation of the VC++ non-standard preprocessor ever occur
> when clang ( or clang++ ) are invoked as opposed to clang-cl being invoked ?
>
> Conversely is the macro _MSC_VER ever predefined when clang ( or clang++ )
> are invoked as opposed to clang-cl being invoked ?
>
> I am hoping the answer to both questions above is 'no', but if it is not I
> need to know what the exceptions are and why.
>

Well, the answer to both is "yes". Essentially, the non-standard
pre-processor behavior is enabled when clang is targeting an MSVC
environment. This can happen if you run 'clang
--target=x86_64-windows-msvc', for example. The good news is that _MSC_VER
should always be defined when we are doing non-standard things, so you can
use that as a feature test.

It is technically possible for the user to invoke clang in a way that
enables MSVC pre-processor quirks without defining _MSC_VER, but that is
not expected to work with code in the wild.

I tried to update or (poor) documentation on our flags here:
http://clang.llvm.org/docs/UsersManual.html#microsoft-extensions
It doesn't discuss pre-processor changes, unfortunately. I've forgotten
what the even are.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160328/d5e95e7b/attachment.html>


More information about the cfe-dev mailing list