On 3/7/26 19:18, Mohamed Mediouni wrote:
> Using strchrnul eagerly results in a failure to compile when using the newest 
> SDKs, with:
>
> error: 'strchrnul' is only available on macOS 15.4 or newer 
> [-Werror,-Wunguarded-availability-new]
>
> Working around that by not using strchrnul when targeting macOS.
>
> This didn't show up on the CI because it used the macOS 15.1 SDK instead of a 
> macOS 15.4 SDK or later.
>
> Signed-off-by: Mohamed Mediouni <[email protected]>
> ---
>   meson.build | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/meson.build b/meson.build
> index 7b4e5bc72b..78bde0611b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2646,7 +2646,12 @@ config_host_data.set('HAVE_COPY_FILE_RANGE', 
> cc.has_function('copy_file_range'))
>   config_host_data.set('HAVE_GETIFADDRS', cc.has_function('getifaddrs'))
>   config_host_data.set('HAVE_GLIB_WITH_SLICE_ALLOCATOR', glib_has_gslice)
>   config_host_data.set('HAVE_OPENPTY', cc.has_function('openpty', 
> dependencies: util))
> -config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul', prefix: 
> osdep_prefix))
> +
> +# strchrnul was introduced in macOS 15.4.
> +# Keep this condition for compatibility of new macOS SDKs with older 
> releases.
> +if host_os != 'darwin'
> +  config_host_data.set('HAVE_STRCHRNUL', cc.has_function('strchrnul', 
> prefix: osdep_prefix))
> +endif

Is -Wunguarded-availability-new enabled by default?  If it is enough to
shut up the compiler maybe you can add a -mmacosx-version-min= flag, but
workarounds on each function are not acceptable.

I'm applying the other patches, but for this one I don't think this is
the right fix.


Paolo


Reply via email to