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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/77346.diff


2 Files Affected:

- (modified) libcxx/include/__config (-5) 
- (modified) libcxx/include/cstdio (+1-1) 


``````````diff
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;

``````````

</details>


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


More information about the libcxx-commits mailing list