[libcxx-commits] [PATCH] D67316: Remove ::gets for FreeBSD 13 and later

Dimitry Andric via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sat Sep 7 08:20:08 PDT 2019


dim updated this revision to Diff 219245.
dim added a comment.

Add `_LIBCPP_C_HAS_NO_GETS` macro to `<__config>`, and use that in `<cstdio>`.


Repository:
  rCXX libc++

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67316/new/

https://reviews.llvm.org/D67316

Files:
  include/__config
  include/cstdio


Index: include/cstdio
===================================================================
--- include/cstdio
+++ include/cstdio
@@ -152,7 +152,7 @@
 
 #ifndef _LIBCPP_HAS_NO_STDIN
 using ::getchar;
-#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_MSVCRT)
+#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS)
 using ::gets;
 #endif
 using ::scanf;
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -1144,6 +1144,11 @@
 #define _LIBCPP_HAS_NO_STDOUT
 #endif
 
+// Some systems do not provide gets() in their C library, for security reasons.
+#if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13)
+#define _LIBCPP_C_HAS_NO_GETS
+#endif
+
 #if defined(__BIONIC__) || defined(__CloudABI__) ||                            \
     defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
 #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67316.219245.patch
Type: text/x-patch
Size: 958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20190907/59af40c3/attachment-0001.bin>


More information about the libcxx-commits mailing list