[PATCH] D24105: [libc++] Limit gets to CRT versions below 14

Shoaib Meenai via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 31 15:36:25 PDT 2016


smeenai created this revision.
smeenai added reviewers: compnerd, EricWF, mclow.lists.
smeenai added subscribers: cfe-commits, kastiglione.

Microsoft removed gets from the CRT in Visual Studio 2015 onwards [1].
Attempting to reference it when targeting CRT versions 14 and above will
cause compile errors.

[1] https://msdn.microsoft.com/en-us/library/2029ea5f.aspx

https://reviews.llvm.org/D24105

Files:
  include/cstdio

Index: include/cstdio
===================================================================
--- include/cstdio
+++ include/cstdio
@@ -98,6 +98,9 @@
 
 #include <__config>
 #include <stdio.h>
+#if defined(_LIBCPP_MSVCRT)
+#include <crtversion.h>
+#endif
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
@@ -155,7 +158,8 @@
 
 #ifndef _LIBCPP_HAS_NO_STDIN
 using ::getchar;
-#if _LIBCPP_STD_VER <= 11
+#if _LIBCPP_STD_VER <= 11 && \
+    (!defined(_VC_CRT_MAJOR_VERSION) || _VC_CRT_MAJOR_VERSION < 14)
 using ::gets;
 #endif
 using ::scanf;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24105.69913.patch
Type: text/x-patch
Size: 568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160831/8338cc4e/attachment.bin>


More information about the cfe-commits mailing list