]> Savannah Git Hosting - gnulib.git/commitdiff
stdio: suppress macOS 13 sprintf warnings
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 6 Mar 2023 00:25:49 +0000 (16:25 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 6 Mar 2023 00:26:45 +0000 (16:26 -0800)
* lib/stdio.in.h (_POSIX_C_SOURCE, _GL_DEFINED__POSIX_C_SOURCE):
Suppress deprecation warnings for sprintf and vsprintf
that were introduced in macOS 13.  These are not useful
for Gnulib itself, and are more likely than not to be
merely an annoyance for Gnulib-using code.

ChangeLog
doc/posix-functions/sprintf.texi
doc/posix-functions/vsprintf.texi
lib/stdio.in.h

index 51591371ea38506c467cc0dd4b670aaaf2a34b9c..c49a0f5b4643562cce2b771edc787c12c6b5e51c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2023-03-05  Paul Eggert  <eggert@cs.ucla.edu>
+
+       stdio: suppress macOS 13 sprintf warnings
+       * lib/stdio.in.h (_POSIX_C_SOURCE, _GL_DEFINED__POSIX_C_SOURCE):
+       Suppress deprecation warnings for sprintf and vsprintf
+       that were introduced in macOS 13.  These are not useful
+       for Gnulib itself, and are more likely than not to be
+       merely an annoyance for Gnulib-using code.
+
 2023-03-05  Bruno Haible  <bruno@clisp.org>
 
        timespec_get tests: Add comment.
index e63f073e0c4edc6db253d62d2a35c0f2da179c26..0ced69dc57dbc72c32a6ba8df8acd06a1a055910 100644 (file)
@@ -66,6 +66,9 @@ Solaris 10.
 @item
 This function can crash in out-of-memory conditions on some platforms:
 FreeBSD 13.0, NetBSD 5.0.
+@item
+The compiler warns that this function is deprecated:
+macOS 13.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
@@ -82,7 +85,4 @@ glibc and others, on x86, x86_64, IA-64 CPUs.
 When formatting an integer with grouping flag, this function inserts thousands
 separators even in the "C" locale on some platforms:
 NetBSD 5.1.
-@item
-The compiler warns that this function is deprecated:
-macOS 13.0
 @end itemize
index 4e30c483fe8ec7b5f64fb5fcb380a57e1cc6b2f4..0ddcdfca12ddf39ce68d9910428101606801db45 100644 (file)
@@ -66,6 +66,9 @@ Solaris 10.
 @item
 This function can crash in out-of-memory conditions on some platforms:
 FreeBSD 13.0, NetBSD 5.0.
+@item
+The compiler warns that this function is deprecated:
+macOS 13.0.
 @end itemize
 
 Portability problems not fixed by Gnulib:
@@ -82,7 +85,4 @@ glibc and others, on x86, x86_64, IA-64 CPUs.
 When formatting an integer with grouping flag, this function inserts thousands
 separators even in the "C" locale on some platforms:
 NetBSD 5.1.
-@item
-The compiler warns that this function is deprecated:
-macOS 13.0
 @end itemize
index 3f8ea985335fac66cedd886d6a37b3f3a27f9cc9..098f841738c950eface0f84a08c261d4315e866e 100644 (file)
 
 #ifndef _@GUARD_PREFIX@_STDIO_H
 
+/* 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
+#endif
+
 #define _GL_ALREADY_INCLUDING_STDIO_H
 
 /* The include_next requires a split double-inclusion guard.  */
 
 #undef _GL_ALREADY_INCLUDING_STDIO_H
 
+#ifdef _GL_DEFINED__POSIX_C_SOURCE
+# undef _GL_DEFINED__POSIX_C_SOURCE
+# undef _POSIX_C_SOURCE
+#endif
+
 #ifndef _@GUARD_PREFIX@_STDIO_H
 #define _@GUARD_PREFIX@_STDIO_H