Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-10 Thread Paul Eggert
On 2023-11-10 10:55, Sevan Janiyan wrote: Apologies, I make a terrible compiler, I was parsing right to left. No problem, I installed the attached.From 96b7ae248368db70dba27ee12f36f7b810a46af0 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 10 Nov 2023 22:33:49 -0800 Subject: [PATCH]

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-10 Thread Sevan Janiyan
On 10/11/2023 08:39, Sevan Janiyan wrote: No because that matches 12 and prior, right? where as you want it to apply to 14 which is the current version of macOS (14, Sonoma). Apologies, I make a terrible compiler, I was parsing right to left. Sevan

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-10 Thread Sevan Janiyan
On 10/11/2023 05:47, Paul Eggert wrote: If the #if should fire when it's 13 and above, shouldn't that be:   # if (defined MAC_OS_X_VERSION_MIN_REQUIRED \     && 13 <= MAC_OS_X_VERSION_MIN_REQUIRED) No because that matches 12 and prior, right? where as you want it to apply to

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-09 Thread Paul Eggert
On 2023-11-09 11:00, Sevan Janiyan wrote: This is wrong, you're applying the change to anything before High Sierra (10.13). You're after Ventura and above (13). # if (defined MAC_OS_X_VERSION_MIN_REQUIRED \   && 13 >= MAC_OS_X_VERSION_MIN_REQUIRED) If the #if should fire when it's

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-09 Thread Sevan Janiyan
On 09/11/2023 19:00, Sevan Janiyan wrote: # if (defined MAC_OS_X_VERSION_MIN_REQUIRED \   && 101300 <= MAC_OS_X_VERSION_MIN_REQUIRED) This is wrong, you're applying the change to anything before High Sierra (10.13). You're after Ventura and above (13). # if (defined

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-09 Thread Sevan Janiyan
Hi Paul, On 09/11/2023 18:51, Paul Eggert wrote: Thanks for the reviews. I installed the attached. # if (defined MAC_OS_X_VERSION_MIN_REQUIRED \ && 101300 <= MAC_OS_X_VERSION_MIN_REQUIRED) This is wrong, you're applying the change to anything before High Sierra (10.13). You're after

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-09 Thread Paul Eggert
Thanks for the reviews. I installed the attached.From 2dd1a7984c6b3e6056cef7e3f9933e0039c21634 Mon Sep 17 00:00:00 2001 From: Paul Eggert 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

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-09 Thread Sevan Janiyan
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 &

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-08 Thread Sevan Janiyan
On 08/11/2023 09:38, Bruno Haible wrote: This looks good. Just as a heads up, the version number is stating High Sirra (10.13) and up, not Ventura (13) and up. In [1] I wrote: "I'll prefer to use the macros without __ prefix; it looks safer to use AvailabilityMacros.h than to bypass it."

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-08 Thread Bruno Haible
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

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Sevan Janiyan
On 08/11/2023 03:54, Paul Eggert wrote: 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. On the system you have macOS 12.5 running, if you check

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Paul Eggert
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

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Sevan Janiyan
On 07/11/2023 21:53, Bruno Haible wrote: You can download the macOS header files of various macOS versions from https://opensource.apple.com/releases/ They are in the Libc package. What I find is that in macOS 13.0, sprintf and vsprintf are deprecated. But in macOS 12.5, they are not. macOS

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Sevan Janiyan
On 07/11/2023 21:53, Bruno Haible wrote: The problem is not with the older platforms; it's with the newer ones — including the newest one, 14.0. Unfortunately, I don't have anything running 13 or newer to be able to test/contribute. Sevan

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Sevan Janiyan
On 07/11/2023 21:53, Bruno Haible wrote: sprintf and vsprintf were deprecated in macOS Sierra 10.12. First, we need to get the facts right. Paul indicated in that the problem occurs starting with macOS 13. I did look at the

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Bruno Haible
> sprintf and vsprintf were deprecated in macOS Sierra 10.12. First, we need to get the facts right. Paul indicated in that the problem occurs starting with macOS 13. You can download the macOS header files of various macOS

Re: [PATCH] lib/stdio.in.h: define _POSIX_C_SOURCE on >=Sierra

2023-11-07 Thread Paul Eggert
Thanks for reporting the issue. However, if I compile this: #include int main (int argc, char **argv) { char buf[1000]; return sprintf (buf, "%d", argc); } using 'cc -O2 -Wall' on macOS 12.6 21G115 with Apple clang-1400.0.29.202, I don't get any warning. This is because the