svn commit: r353579 - head/contrib/libc++/include
John Baldwin
jhb at FreeBSD.org
Tue Oct 15 18:16:11 UTC 2019
Author: jhb
Date: Tue Oct 15 18:16:10 2019
New Revision: 353579
URL: https://svnweb.freebsd.org/changeset/base/353579
Log:
Use __FreeBSD_version to determine if gets() has been removed.
GCC compilers set __FreeBSD__ statically to a build-time determined
targeted version (which in ports always matches the build host's
version). This means that when building any version (12 or 13, etc.)
of riscv or some other architecture via GCC on a 12.x host,
__FreeBSD__ will always be set to 12. As a result, __FreeBSD__ cannot
be used to reliably detect the target FreeBSD version being built.
Instead, __FreeBSD_version from either <sys/param.h> (in the kernel)
or <osreldate.h> (in userland) should be used.
This changes the gets() test in libc++ to use __FreeBSD_version from
<osreldate.h>.
Reported by: jenkins (riscv64 and amd64-gcc)
Reviewed by: dim, imp
Differential Revision: https://reviews.freebsd.org/D22034
Modified:
head/contrib/libc++/include/__config
Modified: head/contrib/libc++/include/__config
==============================================================================
--- head/contrib/libc++/include/__config Tue Oct 15 17:35:39 2019 (r353578)
+++ head/contrib/libc++/include/__config Tue Oct 15 18:16:10 2019 (r353579)
@@ -246,6 +246,7 @@
#ifdef __FreeBSD__
# include <sys/endian.h>
+# include <osreldate.h>
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN
# else // _BYTE_ORDER == _LITTLE_ENDIAN
@@ -1131,7 +1132,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_
// 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
More information about the svn-src-head
mailing list