Skip to content

Commit d5367db

Browse files
committedOct 19, 2019
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 llvm-svn: 375340
1 parent 751e0bb commit d5367db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎libcxx/include/__config

+3-1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,7 @@
242242

243243
#ifdef __FreeBSD__
244244
# include <sys/endian.h>
245+
# include <osreldate.h>
245246
# if _BYTE_ORDER == _LITTLE_ENDIAN
246247
# define _LIBCPP_LITTLE_ENDIAN
247248
# else // _BYTE_ORDER == _LITTLE_ENDIAN
@@ -1178,7 +1179,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
11781179

11791180
// Some systems do not provide gets() in their C library, for security reasons.
11801181
#ifndef _LIBCPP_C_HAS_NO_GETS
1181-
# if defined(_LIBCPP_MSVCRT) || (defined(__FreeBSD__) && __FreeBSD__ >= 13)
1182+
# if defined(_LIBCPP_MSVCRT) || \
1183+
(defined(__FreeBSD_version) && __FreeBSD_version >= 1300043)
11821184
# define _LIBCPP_C_HAS_NO_GETS
11831185
# endif
11841186
#endif

0 commit comments

Comments
 (0)
Please sign in to comment.