Thanks for the reviews. I installed the attached.
From 2dd1a7984c6b3e6056cef7e3f9933e0039c21634 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Thu, 9 Nov 2023 10:50:30 -0800
Subject: [PATCH] stdio: port better to older macOS

* lib/stdio.in.h: Do not define _POSIX_C_SOURCE on older macOS,
as it is not needed and defining it causes other problems.
Problem reported by Sevan Janiyan in:
https://mail.gnu.org/r/bug-gnulib/2023-11/msg00039.html
---
 ChangeLog      |  8 ++++++++
 lib/stdio.in.h | 10 ++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 0c49471d04..b8fd98a2b1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2023-11-09  Paul Eggert  <egg...@cs.ucla.edu>
+
+	stdio: port better to older macOS
+	* lib/stdio.in.h: Do not define _POSIX_C_SOURCE on older macOS,
+	as it is not needed and defining it causes other problems.
+	Problem reported by Sevan Janiyan in:
+	https://mail.gnu.org/r/bug-gnulib/2023-11/msg00039.html
+
 2023-11-09  Bruno Haible  <br...@clisp.org>
 
 	rand: Add tests.
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 118874d877..22b5ca46b2 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -38,8 +38,14 @@
 
 /* Suppress macOS deprecation warnings for sprintf and vsprintf.  */
 #if (defined __APPLE__ && defined __MACH__) && !defined _POSIX_C_SOURCE
-# define _POSIX_C_SOURCE 200809L
-# define _GL_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
 
 #define _GL_ALREADY_INCLUDING_STDIO_H
-- 
2.40.1

Reply via email to