[libcxx-commits] [PATCH] D69174: Refine check for `_LIBCPP_C_HAS_NO_GETS` on FreeBSD
Dimitry Andric via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 18 08:47:52 PDT 2019
dim created this revision.
dim added reviewers: EricWF, mclow.lists, emaste.
Herald added subscribers: ldionne, christof, krytarowski.
In D67316 <https://reviews.llvm.org/D67316> we added `_LIBCPP_C_HAS_NO_GETS` to signal that the C library
does not provide `gets()`, and added a test for FreeBSD 13 or higher,
using the compiler-defined `__FreeBSD__` macro.
Unfortunately this did not work that well for FreeBSD's own CI process,
since the gcc compilers used for some architectures define `__FreeBSD__`
to match the build host, not the target.
Instead, we should use the `__FreeBSD_version` macro from the userland
header `<osreldate.h>`, which is more fine-grained. See also
https://reviews.freebsd.org/D22034.
Repository:
rCXX libc++
https://reviews.llvm.org/D69174
Files:
include/__config
Index: include/__config
===================================================================
--- include/__config
+++ include/__config
@@ -242,6 +242,7 @@
#ifdef __FreeBSD__
# include <sys/endian.h>
+# include <osreldate.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN
# else // _BYTE_ORDER == _LITTLE_ENDIAN
@@ -1164,7 +1165,8 @@
// 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)
+# if defined(_LIBCPP_MSVCRT) || \
+ (defined(__FreeBSD__) && __FreeBSD_version >= 1300043)
# define _LIBCPP_C_HAS_NO_GETS
# endif
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D69174.225640.patch
Type: text/x-patch
Size: 709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20191018/a8d62e16/attachment.bin>
More information about the libcxx-commits
mailing list