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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Sam McCall via cfe-dev
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
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [libc++] #if defined(_MSC_VER) && !defined(__clang__)

Sam McCall via cfe-dev

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 <[hidden email]> on behalf of cfe-dev <[hidden email]>
Reply-To: Christiano SA <[hidden email]>
Date: Sunday, April 15, 2018 at 6:39 PM
To: cfe-dev <[hidden email]>
Subject: [cfe-dev] [libc++] #if defined(_MSC_VER) && !defined(__clang__)

 

_______________________________________________

cfe-dev mailing list

 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev