* [PATCH] stdio: suppress macOS 13 sprintf warnings
@ 2023-03-06 0:27 Paul Eggert
0 siblings, 0 replies; only message in thread
From: Paul Eggert @ 2023-03-06 0:27 UTC (permalink / raw)
To: bug-gnulib; +Cc: Paul Eggert
* 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 | 9 +++++++++
doc/posix-functions/sprintf.texi | 6 +++---
doc/posix-functions/vsprintf.texi | 6 +++---
lib/stdio.in.h | 11 +++++++++++
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 51591371ea..c49a0f5b46 100644
--- 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.
diff --git a/doc/posix-functions/sprintf.texi b/doc/posix-functions/sprintf.texi
index e63f073e0c..0ced69dc57 100644
--- a/doc/posix-functions/sprintf.texi
+++ b/doc/posix-functions/sprintf.texi
@@ -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
diff --git a/doc/posix-functions/vsprintf.texi b/doc/posix-functions/vsprintf.texi
index 4e30c483fe..0ddcdfca12 100644
--- a/doc/posix-functions/vsprintf.texi
+++ b/doc/posix-functions/vsprintf.texi
@@ -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
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 3f8ea98533..098f841738 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -36,6 +36,12 @@
#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. */
@@ -43,6 +49,11 @@
#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
--
2.39.2
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-06 0:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-06 0:27 [PATCH] stdio: suppress macOS 13 sprintf warnings Paul Eggert
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).