Subject: re: [Trunk] Xcode 14.1+ (and macOS 13.0+) deprecate sprintf()

From: Paul Eggert <[email-masked]>
Date: Thu, 3 Nov 2022 11:30:50 -0700

It appears that Apple has gone on the warpath against sprintf even if 
you compile with plain 'gcc' with no options, which means 
--disable-gcc-warnings does not suppress the false alarms.

I installed the attached further patch to attempt to pacify Apple's 
compiler; please give it a try.

Perhaps Apple's compiler will start complaining about strcpy next....
From 39f5696921c1618f46358a5c189244d3993a1fca Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Thu, 3 Nov 2022 11:09:53 -0700
Subject: [PATCH] Improve suppression of bogus macOS warnings

* configure.ac: On macOS, always use -Wno-deprecated-declarations,
as the false alarms appear even if --disable-gcc-warnings is given
(Bug#58966).
---
 configure.ac | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index c9d1eb5709..b656dba4d9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1144,12 +1144,6 @@ AC_DEFUN
     gl_WARN_ADD([-Wno-int-in-bool-context])
   fi
 
-  # Suppress deprecation warnings from using sprintf variants,
-  # starting with Xcode 14.1 on macOS 13.
-  if test $opsys = darwin; then
-    gl_WARN_ADD([-Wno-deprecated-declarations])
-  fi
-
   # This causes too much noise in the MinGW build
   if test $opsys = mingw32; then
     gl_WARN_ADD([-Wno-pointer-sign])
@@ -1176,6 +1170,13 @@ AC_DEFUN
   gl_WARN_ADD([-Wno-tautological-constant-out-of-range-compare])
 fi
 
+# Suppress deprecation warnings from using sprintf variants,
+# starting with Xcode 14.1 on macOS 13.
+# These warnings are false alarms, as Emacs usage of sprintf is safe.
+if test $opsys = darwin; then
+  gl_WARN_ADD([-Wno-deprecated-declarations])
+fi
+
 # Use a slightly smaller set of warning options for lib/.
 nw=
 nw="$nw -Wunused-macros"
-- 
2.37.2