Re: macos ventura SDK spews warnings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: macos ventura SDK spews warnings
Date
Msg-id 1936798.1665953124@sss.pgh.pa.us
Whole thread Raw
In response to Re: macos ventura SDK spews warnings  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: macos ventura SDK spews warnings  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
I wrote:
> I think the correct, future-proof fix is to s/REF/REF_P/ in the
> grammar.

Done like that, after which I found that the pre-v12 branches are
compiling perfectly warning-free with the 13.0 SDK, despite nothing
having been done about sprintf.  This confused me mightily, but
after digging in Apple's headers I understand it.  What actually
gets provided by <stdio.h> is a declaration of sprintf(), now
with deprecation attribute attached, followed awhile later by

#if __has_builtin(__builtin___sprintf_chk) || defined(__GNUC__)
extern int __sprintf_chk (char * __restrict, int, size_t,
              const char * __restrict, ...);

#undef sprintf
#define sprintf(str, ...) \
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
#endif

So in the ordinary course of events, calling sprintf() results in
calling this non-deprecated builtin.  Only if you "#undef sprintf"
will you see the deprecation message.  snprintf.c does that, so
we see the message when that's built.  But if we don't use snprintf.c,
as the older branches do not on macOS, we don't ever #undef sprintf.

So for now, there seems no need for -Wno-deprecated, and I'm not
going to install it.

What I *am* seeing, in the 9.5 and 9.6 branches, is a ton of

ld: warning: -undefined dynamic_lookup may not work with chained fixups

apparently because we are specifying -Wl,-undefined,dynamic_lookup
which the other branches don't do.  That's kind of annoying,
but it looks like preventing that would be way too invasive :-(.
We'd added it to un-break some cases in the contrib transform
modules, and we didn't have a better solution until v10 [1].

            regards, tom lane

[1] https://www.postgresql.org/message-id/2652.1475512158%40sss.pgh.pa.us



pgsql-hackers by date:

Previous
From: Melanie Plageman
Date:
Subject: Re: New "single-call SRF" APIs are very confusingly named
Next
From: Andres Freund
Date:
Subject: Re: macos ventura SDK spews warnings