[PATCH] D34588: Check for _MSC_VER before define _LIBCPP_MSVCRT

Bruno Cardoso Lopes via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 23 17:33:11 PDT 2017


bruno created this revision.

_LIBCPP_MSVCRT is defined because _WIN32 is defined and __MINGW32__ is not.

Some non-windows targets using MS extensions define _WIN32 for compatibility with Windows but do not have MSVC compatibility. This patch is an attempt to do not have _LIBCPP_MSVCRT defined for such targets, allowing libcxx to build. This patch seems the natural way to go for me, but others more experienced here might have additional suggestions?


https://reviews.llvm.org/D34588

Files:
  include/__config


Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -229,9 +229,12 @@
 #  define _LIBCPP_SHORT_WCHAR   1
 // Both MinGW and native MSVC provide a "MSVC"-like enviroment
 #  define _LIBCPP_MSVCRT_LIKE
-// If mingw not explicitly detected, assume using MS C runtime only.
+// If mingw not explicitly detected, assume using MS C runtime only if
+// a MS compatibility version is specified.
 #  ifndef __MINGW32__
-#    define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
+#    ifdef _MSC_VER
+#      define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
+#    endif
 #  endif
 #  if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
 #    define _LIBCPP_HAS_BITSCAN64


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34588.103807.patch
Type: text/x-patch
Size: 800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170624/6b38bc55/attachment.bin>


More information about the cfe-commits mailing list