Partially undo r351659, which unconditionally removed gets(3) from libc++.
Instead, pull in r371324 from upstream libc++ trunk (by me): Remove ::gets for FreeBSD 13 and later Summary: In https://svnweb.freebsd.org/changeset/base/351659 @emaste removed gets() from FreeBSD 13's libc, and our copies of libc++ and libstdc++. In that change, the declarations were simply deleted, but I would like to propose this conditional test instead. Reviewers: EricWF, mclow.lists, emaste Reviewed By: mclow.lists Subscribers: krytarowski, christof, ldionne, emaste, libcxx-commits Differential Revision: https://reviews.llvm.org/D67316 This makes these changes more MFCable.
This commit is contained in:
parent
0f80acb965
commit
2ee8a62f0f
@ -1129,6 +1129,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
#define _LIBCPP_HAS_NO_STDOUT
|
||||
#endif
|
||||
|
||||
// Some systems do not provide gets() in their C library, for security reasons.
|
||||
#ifndef _LIBCPP_C_HAS_NO_GETS
|
||||
# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13)
|
||||
# define _LIBCPP_C_HAS_NO_GETS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(__BIONIC__) || defined(__CloudABI__) || \
|
||||
defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC)
|
||||
#define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE
|
||||
|
@ -73,6 +73,7 @@ int fputc(int c, FILE* stream);
|
||||
int fputs(const char* restrict s, FILE* restrict stream);
|
||||
int getc(FILE* stream);
|
||||
int getchar(void);
|
||||
char* gets(char* s); // removed in C++14
|
||||
int putc(int c, FILE* stream);
|
||||
int putchar(int c);
|
||||
int puts(const char* s);
|
||||
@ -151,6 +152,9 @@ using ::tmpnam;
|
||||
|
||||
#ifndef _LIBCPP_HAS_NO_STDIN
|
||||
using ::getchar;
|
||||
#if _LIBCPP_STD_VER <= 11 && !defined(_LIBCPP_C_HAS_NO_GETS)
|
||||
using ::gets;
|
||||
#endif
|
||||
using ::scanf;
|
||||
using ::vscanf;
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user