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;


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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to