On 08/11/2023 04:34, Sevan Janiyan wrote:
__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ is defined in cpp(1).
I can't confirm on newer macOS versions but it would be safe to assume
AvailabilityMacros.h is available if (defined __APPLE__ && defined
__MACH__) since the header covers mobile & desktop.
Untested:
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -38,8 +38,11 @@
/* Suppress macOS deprecation warnings for sprintf and vsprintf. */
#if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE
+# include <AvailabilityMacros.h>
+# if defined(MAC_OS_X_VERSION_MIN_REQUIRED) &&
MAC_OS_X_VERSION_MIN_REQUIRED >= 130000
# define _POSIX_C_SOURCE 200809L
# define _GL_DEFINED__POSIX_C_SOURCE
+# endif
#endif
#define _GL_ALREADY_INCLUDING_STDIO_H
Bizarrely, the version in the XNU source[1] only has definitions up to
macOS 10.12 (Sierra). There has to be another copy but the repositories
are not searchable which makes referencing without a running system
difficult.
I have been able to find references for other projects that they refer
to Ventura (macOS 13) as 130000
https://github.com/macvim-dev/macvim/blob/e02454b9e6ace2dce8c25a5bbbf73d93a5685261/src/MacVim/MacVim.h#L52
Sevan
[1]
https://github.com/apple-oss-distributions/xnu/blob/xnu-8792.41.9/EXTERNAL_HEADERS/AvailabilityMacros.h