bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning
@ 2022-11-25  2:28 Minsoo Choo
  2022-11-25 22:25 ` Bruno Haible
  2022-11-26  3:31 ` Paul Eggert
  0 siblings, 2 replies; 5+ messages in thread
From: Minsoo Choo @ 2022-11-25  2:28 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Minsoo Choo

---
sprintf is deprecated on macOS. Silence this warning by silencing
-Wdeprecated-declartions.

#if __GUNC__ >= 3 && defined(__APPLE__)
can be used as alternative if we don't want to disable this warning on
every system.

 lib/vasnprintf.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c
index 01d18bf59..577dbbcd3 100644
--- a/lib/vasnprintf.c
+++ b/lib/vasnprintf.c
@@ -68,6 +68,11 @@
 # pragma GCC diagnostic ignored "-Wanalyzer-null-argument"
 #endif
 
+/* Using sprintf here is safe. Silence -Wdeprecated-declartions warning. */
+#if __GNUC__ >= 3
+# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+#endif
+
 #include <alloca.h>
 
 /* Specification.  */

base-commit: 6ec9bc73686fd42d0a1a82c914d89176745cddbd
-- 
2.37.1 (Apple Git-137.1)



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning
  2022-11-25  2:28 [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning Minsoo Choo
@ 2022-11-25 22:25 ` Bruno Haible
  2022-11-26  1:54   ` Sam James
  2022-11-26  4:13   ` Minsoo Choo
  2022-11-26  3:31 ` Paul Eggert
  1 sibling, 2 replies; 5+ messages in thread
From: Bruno Haible @ 2022-11-25 22:25 UTC (permalink / raw)
  To: bug-gnulib; +Cc: Minsoo Choo, Minsoo Choo

Minsoo Choo wrote:
> sprintf is deprecated on macOS. Silence this warning by silencing
> -Wdeprecated-declartions.

I don't get a warning by compiling the 'vasnprintf-posix' module
on macOS 12.6, even with -Wall -Wdeprecated-declarations.

What OS are you on, what are you compiling, and what are the values
for CC, CFLAGS, and CPPFLAGS that you have provided?

Bruno





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning
  2022-11-25 22:25 ` Bruno Haible
@ 2022-11-26  1:54   ` Sam James
  2022-11-26  4:13   ` Minsoo Choo
  1 sibling, 0 replies; 5+ messages in thread
From: Sam James @ 2022-11-26  1:54 UTC (permalink / raw)
  To: Bruno Haible; +Cc: Gnulib bugs, Minsoo Choo, Minsoo Choo

[-- Attachment #1: Type: text/plain, Size: 573 bytes --]



> On 25 Nov 2022, at 22:25, Bruno Haible <bruno@clisp.org> wrote:
> 
> Minsoo Choo wrote:
>> sprintf is deprecated on macOS. Silence this warning by silencing
>> -Wdeprecated-declartions.
> 
> I don't get a warning by compiling the 'vasnprintf-posix' module
> on macOS 12.6, even with -Wall -Wdeprecated-declarations.
> 
> What OS are you on, what are you compiling, and what are the values
> for CC, CFLAGS, and CPPFLAGS that you have provided?

13.0 is needed - see https://lists.gnu.org/archive/html/bug-gnulib/2022-11/msg00013.html.

> 
> Bruno
> 

[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 358 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning
  2022-11-25  2:28 [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning Minsoo Choo
  2022-11-25 22:25 ` Bruno Haible
@ 2022-11-26  3:31 ` Paul Eggert
  1 sibling, 0 replies; 5+ messages in thread
From: Paul Eggert @ 2022-11-26  3:31 UTC (permalink / raw)
  To: Minsoo Choo, bug-gnulib; +Cc: Minsoo Choo

On 2022-11-24 18:28, Minsoo Choo wrote:
> sprintf is deprecated on macOS. Silence this warning by silencing
> -Wdeprecated-declartions.

Surely this sort of thing should be done by a single change to the stdio 
module (e.g., editing lib/stdio.in.h), not by changing every module that 
calls sprintf.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning
  2022-11-25 22:25 ` Bruno Haible
  2022-11-26  1:54   ` Sam James
@ 2022-11-26  4:13   ` Minsoo Choo
  1 sibling, 0 replies; 5+ messages in thread
From: Minsoo Choo @ 2022-11-26  4:13 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib, Minsoo Choo






Sent with Proton Mail secure email.

------- Original Message -------
On Friday, November 25th, 2022 at 5:25 PM, Bruno Haible <bruno@clisp.org> wrote:


> Minsoo Choo wrote:
> 
> > sprintf is deprecated on macOS. Silence this warning by silencing
> > -Wdeprecated-declartions.
> 
> 
> I don't get a warning by compiling the 'vasnprintf-posix' module
> on macOS 12.6, even with -Wall -Wdeprecated-declarations.
> 
> What OS are you on, what are you compiling, and what are the values
> for CC, CFLAGS, and CPPFLAGS that you have provided?
> 
> Bruno
> 


I am using macOS 13.0.1(darwin 22.1.0). I used clang, which is the default compiler on macOS. I haven't set any specific CFLAGS/CPPFLAGS and build through './bootstrap && ./configure && ./make -j12'


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-11-26  4:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-25  2:28 [PATCH silence -Wdeprecation-warning for sprintf on macOS] silence sprintf deprecation warning Minsoo Choo
2022-11-25 22:25 ` Bruno Haible
2022-11-26  1:54   ` Sam James
2022-11-26  4:13   ` Minsoo Choo
2022-11-26  3:31 ` 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).