diff options
author | Dimitry Andric <dimitry@andric.com> | 2019-10-19 10:59:23 +0000 |
---|---|---|
committer | Dimitry Andric <dimitry@andric.com> | 2019-10-19 10:59:23 +0000 |
commit | d5367db95c4295b088bf9ae3cf99e24d8bf7e249 (patch) | |
tree | cbf36d48fd34c7ad1d4f8ae99a3b129fe6bb17e1 | |
parent | 751e0bb6af33786339761173e61d6e37b752836e (diff) | |
download | bcm5719-llvm-d5367db95c4295b088bf9ae3cf99e24d8bf7e249.tar.gz bcm5719-llvm-d5367db95c4295b088bf9ae3cf99e24d8bf7e249.zip |
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
-rw-r--r-- | libcxx/include/__config | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/libcxx/include/__config b/libcxx/include/__config index 1ae2fdc7b81..044cd0ceb00 100644 --- a/libcxx/include/__config +++ b/libcxx/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 @@ -1178,7 +1179,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container( // 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 |