[libcxx-commits] [libcxx] r375340 - Refine check for `_LIBCPP_C_HAS_NO_GETS` on FreeBSD
Dimitry Andric via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Oct 19 03:59:23 PDT 2019
Author: dim
Date: Sat Oct 19 03:59:23 2019
New Revision: 375340
URL: http://llvm.org/viewvc/llvm-project?rev=375340&view=rev
Log:
Refine check for `_LIBCPP_C_HAS_NO_GETS` on FreeBSD
Summary:
In 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>.
Reviewers: EricWF, mclow.lists, emaste, ldionne
Reviewed By: emaste, ldionne
Subscribers: dexonsmith, bsdjhb, krytarowski, christof, ldionne, libcxx-commits
Differential Revision: https://reviews.llvm.org/D69174
Modified:
libcxx/trunk/include/__config
Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=375340&r1=375339&r2=375340&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Sat Oct 19 03:59:23 2019
@@ -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
@@ -1178,7 +1179,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
// 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_version) && __FreeBSD_version >= 1300043)
# define _LIBCPP_C_HAS_NO_GETS
# endif
#endif
More information about the libcxx-commits
mailing list