Paul Eggert wrote: > 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
This looks good. In [1] I wrote: "I'll prefer to use the macros without __ prefix; it looks safer to use AvailabilityMacros.h than to bypass it." But as long as we don't have proof of the contrary, both the idiom from unistd.h and the idiom from get_ppid_of.c look equally safe to use. Bruno [1] https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00071.html