cross-build: Workaround system-provided strchrnul on macOS 15.4+

macOS added a native strchrnul in 15.4.  There is not an easy way to
detect it at compile time, so use a macro to rename our local inline
version to avoid conflicts while also forcing its use during
bootstrap.  The local version can be removed once macOS versions older
than 15.4 are no longer supported as build hosts.

Co-authored by:	jrtc27
Reported by:	kib
Reviewed by:	jrtc27
Differential Revision:	https://reviews.freebsd.org/D49893
This commit is contained in:
John Baldwin 2025-04-28 13:10:41 -04:00
parent dcb2a1ae46
commit 4e2616b74c

View file

@ -38,9 +38,12 @@
#include_next <string.h>
/*
* strchrnul is not provided by macOS and the strchrnul.c implementation
* can not be compiled on macOS so just provide it inline here
* strchrnul is provided by macOS 15.4 and later. However, there is
* no good way to detect the current host version at compile time, so
* provide an inline definition under an alternate name.
*/
#define strchrnul(p, ch) __freebsd_strchrnul(p, ch)
static inline char *
strchrnul(const char *p, int ch)
{