[cfe-dev] [libc++] #if defined(_MSC_VER) && !defined(__clang__)

Shoaib Meenai via cfe-dev cfe-dev at lists.llvm.org
Sun Apr 15 20:05:53 PDT 2018


Clang can operate in Visual Studio compatibility mode, in which case it will define both _MSC_VER and __clang__. The check you posted ensures that the compiler is actually MSVC and not clang in MSVC compatibility mode. https://clang.llvm.org/docs/MSVCCompatibility.html has more information on the MSVC compatibility.

From: cfe-dev <cfe-dev-bounces at lists.llvm.org> on behalf of cfe-dev <cfe-dev at lists.llvm.org>
Reply-To: Christiano SA <christiano at engineer.com>
Date: Sunday, April 15, 2018 at 6:39 PM
To: cfe-dev <cfe-dev at lists.llvm.org>
Subject: [cfe-dev] [libc++] #if defined(_MSC_VER) && !defined(__clang__)

The line 14 of include/__config has the following code: #if defined(_MSC_VER) &&  !defined(__clang__) . I know that the compiler clang defines __clang__ and Visual Studio defines _MSC_VER, however, why should it test the __clang__ if it would only be tested if it is being compiled on Visual Studio, which doesn't have __clang__ anyway?
_______________________________________________
cfe-dev mailing list
cfe-dev at lists.llvm.org<mailto:cfe-dev at lists.llvm.org>
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.llvm.org_cgi-2Dbin_mailman_listinfo_cfe-2Ddev&d=DwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=o3kDXzdBUE3ljQXKeTWOMw&m=5yX5V4blPPfpifwRnJX-AgAIhcgD5YjC1gKFgzNnnoA&s=UVQvhd6zG2oH9ZhCV4ZwFtR8DmQBlMLedrUf6ZIjTKQ&e=

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20180416/f8c1a732/attachment.html>


More information about the cfe-dev mailing list