svn commit: r352538 - projects/clang900-import/contrib/libc++/include

Dimitry Andric dim at FreeBSD.org
Thu Sep 19 19:39:34 UTC 2019


Author: dim
Date: Thu Sep 19 19:39:34 2019
New Revision: 352538
URL: https://svnweb.freebsd.org/changeset/base/352538

Log:
  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.

Modified:
  projects/clang900-import/contrib/libc++/include/__config
  projects/clang900-import/contrib/libc++/include/cstdio

Modified: projects/clang900-import/contrib/libc++/include/__config
==============================================================================
--- projects/clang900-import/contrib/libc++/include/__config	Thu Sep 19 19:26:12 2019	(r352537)
+++ projects/clang900-import/contrib/libc++/include/__config	Thu Sep 19 19:39:34 2019	(r352538)
@@ -1129,6 +1129,13 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
 #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

Modified: projects/clang900-import/contrib/libc++/include/cstdio
==============================================================================
--- projects/clang900-import/contrib/libc++/include/cstdio	Thu Sep 19 19:26:12 2019	(r352537)
+++ projects/clang900-import/contrib/libc++/include/cstdio	Thu Sep 19 19:39:34 2019	(r352538)
@@ -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


More information about the svn-src-projects mailing list