Re: On non-Windows, hard depend on uselocale(3)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: On non-Windows, hard depend on uselocale(3)
Дата
Msg-id 1026321.1765562828@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: On non-Windows, hard depend on uselocale(3)  (Peter Eisentraut <peter@eisentraut.org>)
Список pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
> On 28.08.24 20:50, Peter Eisentraut wrote:
>> I suggest that the simplification of the xlocale.h configure tests could
>> be committed separately.  This would also be useful independent of this,
>> and it's a sizeable chunk of this patch.

> To keep this moving along a bit, I have extracted this part and
> committed it separately.  I had to make a few small tweaks, e.g., there
> was no check for xlocale.h in configure.ac, and the old
> xlocale.h-including stanza could be removed from chklocale.h.  Let's see
> how this goes.

For the archives' sake --- I discovered today during a "git bisect"
session that commits between 35eeea623 ("Use thread-safe
nl_langinfo_l(), not nl_langinfo()") and 9c2a6c5a5 ("Simplify checking
for xlocale.h", the commit Peter refers to here) fail to build on
current macOS (26/Tahoe):

chklocale.c:330:8: error: call to undeclared function 'nl_langinfo_l'; ISO C99 and later do not support implicit
functiondeclarations [-Wimplicit-function-declaration] 
  330 |         sys = nl_langinfo_l(CODESET, loc);
      |               ^
chklocale.c:330:8: note: did you mean 'nl_langinfo'?
/Library/Developer/CommandLineTools/SDKs/MacOSX26.1.sdk/usr/include/_langinfo.h:116:20: note: 'nl_langinfo' declared
here
  116 | char    *_LIBC_CSTR   nl_langinfo(nl_item);
      |                       ^
chklocale.c:330:6: error: incompatible integer to pointer conversion assigning to 'char *' from 'int'
[-Wint-conversion]
  330 |         sys = nl_langinfo_l(CODESET, loc);
      |             ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.

This happens because nl_langinfo_l() is declared in xlocale.h,
but chklocale.c elects not to #include that, evidently because
it's no longer needed to obtain typedef locale_t.

AFAICS there's nothing we can do about this retroactively;
it'll be a more or less permanent landmine for bisecting on macOS.
Fortunately it's not too difficult to work around, you can just do

diff --git a/src/port/chklocale.c b/src/port/chklocale.c
index 9506cd87ed8..0e35e0cf55f 100644
--- a/src/port/chklocale.c
+++ b/src/port/chklocale.c
@@ -23,9 +23,7 @@
 #include <langinfo.h>
 #endif

-#ifdef LOCALE_T_IN_XLOCALE
 #include <xlocale.h>
-#endif

 #include "mb/pg_wchar.h"

when trying to build one of the affected commits.  Another option
that might fit into a bisecting workflow more easily is to inject
-DLOCALE_T_IN_XLOCALE into CPPFLAGS.

            regards, tom lane



В списке pgsql-hackers по дате отправления: