[libcxx-commits] [libcxx] [libc++] Remove _LIBCPP_C_HAS_NO_GETS (PR #77346)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jan 8 09:32:29 PST 2024


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/77346

Since we use _LIBCPP_USING_IF_EXISTS to handle missing C library functions now, _LIBCPP_C_HAS_NO_GETS shouldn't be necessary anymore. See discussion thread in #77242 for more details.

>From dced98dee3685a6890819d769466770e0ccfe49c Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Mon, 8 Jan 2024 12:30:51 -0500
Subject: [PATCH] [libc++] Remove _LIBCPP_C_HAS_NO_GETS

Since we use _LIBCPP_USING_IF_EXISTS to handle missing C library functions
now, _LIBCPP_C_HAS_NO_GETS shouldn't be necessary anymore. See discussion
thread in #77242 for more details.
---
 libcxx/include/__config | 5 -----
 libcxx/include/cstdio   | 2 +-
 2 files changed, 1 insertion(+), 6 deletions(-)

diff --git a/libcxx/include/__config b/libcxx/include/__config
index 082c73e672c749..1958d5c50ca911 100644
--- a/libcxx/include/__config
+++ b/libcxx/include/__config
@@ -1133,11 +1133,6 @@ __sanitizer_verify_double_ended_contiguous_container(const void*, const void*, c
 #    define _LIBCPP_HAS_TRIVIAL_CONDVAR_DESTRUCTION
 #  endif
 
-// Some systems do not provide gets() in their C library, for security reasons.
-#  if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) || defined(__OpenBSD__)
-#    define _LIBCPP_C_HAS_NO_GETS
-#  endif
-
 #  if defined(__BIONIC__) || defined(__NuttX__) || defined(__Fuchsia__) || defined(__wasi__) ||                        \
       defined(_LIBCPP_HAS_MUSL_LIBC) || defined(__OpenBSD__)
 #    define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
diff --git a/libcxx/include/cstdio b/libcxx/include/cstdio
index b1b0ff8d350393..0a867cec1a388b 100644
--- a/libcxx/include/cstdio
+++ b/libcxx/include/cstdio
@@ -159,7 +159,7 @@ using ::tmpfile _LIBCPP_USING_IF_EXISTS;
 using ::tmpnam _LIBCPP_USING_IF_EXISTS;
 
 using ::getchar _LIBCPP_USING_IF_EXISTS;
-#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS)
+#if _LIBCPP_STD_VER <= 11
 using ::gets _LIBCPP_USING_IF_EXISTS;
 #endif
 using ::scanf _LIBCPP_USING_IF_EXISTS;



More information about the libcxx-commits mailing list