* lib/strerror.c, lib/vasnprintf.c: Pacify clang 14 on macOS 12.6.
---
 ChangeLog        | 5 +++++
 lib/strerror.c   | 6 ++++++
 lib/vasnprintf.c | 6 ++++++
 3 files changed, 17 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index c4b2290d6c..4a6ace7d16 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2024-11-19  Paul Eggert  <egg...@cs.ucla.edu>
+
+       strerror, vasnprintf: pacify clang 14 on macOS
+       * lib/strerror.c, lib/vasnprintf.c: Pacify clang 14 on macOS 12.6.
+
 2024-11-19  Pádraig Brady  <p...@draigbrady.com>
 
        unicodeio: avoid iconv issues for most ASCII characters
diff --git a/lib/strerror.c b/lib/strerror.c
index 6b760ff45c..3c0b4cdd60 100644
--- a/lib/strerror.c
+++ b/lib/strerror.c
@@ -31,6 +31,12 @@
 /* Use the system functions, not the gnulib overrides in this file.  */
 #undef sprintf
 
+/* macOS 12's "warning: 'sprintf' is deprecated" is pointless,
+   as sprintf is used safely here.  */
+#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2)
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 char *
 strerror (int n)
 #undef strerror
diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 6ae95ca5dd..c06ae019a5 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -217,6 +217,12 @@
 /* Here we need to call the native sprintf, not rpl_sprintf.  */
 #undef sprintf
 
+/* macOS 12's "warning: 'sprintf' is deprecated" is pointless,
+   as sprintf is used safely here.  */
+#if defined __APPLE__ && defined __MACH__ && _GL_GNUC_PREREQ (4, 2)
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 /* GCC >= 4.0 with -Wall emits unjustified "... may be used uninitialized"
    warnings in this file.  Use -Dlint to suppress them.  */
 #if defined GCC_LINT || defined lint
-- 
2.43.0


Reply via email to