|
| From: | Paul Eggert |
| Subject: | Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra |
| Date: | Tue, 7 Nov 2023 19:54:40 -0800 |
| User-agent: | Mozilla Thunderbird |
On 11/7/23 13:53, Bruno Haible wrote:
The problem is not with the older platforms; it's with the newer ones — including the newest one, 14.0.
Oh, sorry, my lack of macOS expertise is showing....
Alternatively, perhaps we should do something like the following? That is, don't bother with pacification if sprintf and vsprintf are macrosThis approach won't work, because sprintf and vsprintf are defined as macros only in the system's <stdio.h>. But we need to decide whether to define _POSIX_C_SOURCE*before* including the system's <stdio.h>.
OK, how about if we do something like this instead? I hope the "101300" is the right version, and the business with __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is taken from unistd.in.h.
/* Suppress macOS deprecation warnings for sprintf and vsprintf. */
#if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE
# ifdef __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__
# include <AvailabilityMacros.h>
# endif
# if (defined MAC_OS_X_VERSION_MIN_REQUIRED \
&& 101300 <= MAC_OS_X_VERSION_MIN_REQUIRED)
# define _POSIX_C_SOURCE 200809L
# define _GL_DEFINED__POSIX_C_SOURCE
# endif
#endif
| [Prev in Thread] | Current Thread | [Next in Thread] |