[libcxx] r308225 - Check for _MSC_VER before defining _LIBCPP_MSVCRT

Bruno Cardoso Lopes via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 17 14:52:31 PDT 2017

Author: bruno
Date: Mon Jul 17 14:52:31 2017
New Revision: 308225

URL: http://llvm.org/viewvc/llvm-project?rev=308225&view=rev
Check for _MSC_VER before defining _LIBCPP_MSVCRT

Some targets (e.g. Darwin) might have the Win32 API available, but they
do not use MSVC CRT. Assume _LIBCPP_MSVCRT only when _MSC_VER is available
and __MINGW32__ isn't defined.

Differential Revision: https://reviews.llvm.org/D34588



Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=308225&r1=308224&r2=308225&view=diff
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Mon Jul 17 14:52:31 2017
@@ -229,8 +229,9 @@
 #  define _LIBCPP_SHORT_WCHAR   1
 // Both MinGW and native MSVC provide a "MSVC"-like enviroment
-// If mingw not explicitly detected, assume using MS C runtime only.
-#  ifndef __MINGW32__
+// If mingw not explicitly detected, assume using MS C runtime only if
+// a MS compatibility version is specified.
+#  if defined(_MSC_VER) && !defined(__MINGW32__)
 #    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
 #  endif
 #  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))

More information about the cfe-commits mailing list