1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

All supported systems have locale_t.

locale_t is defined by POSIX.1-2008 and SUSv4, and available on all
targeted systems.  For Windows, win32_port.h redirects to a partial
implementation called _locale_t.  We can now remove a lot of
compile-time tests for HAVE_LOCALE_T, and associated comments and dead
code branches that were needed for older computers.

Since configure + MinGW builds didn't detect locale_t but now we assume
that all systems have it, further inconsistencies among the 3 Windows build
systems were revealed.  With this commit, we no longer define
HAVE_WCSTOMBS_L and HAVE_MBSTOWCS_L on any Windows build system, but
we have logic to deal with that so that replacements are available where
appropriate.

Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Tristan Partin <tristan@neon.tech>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/CA%2BhUKGLg7_T2GKwZFAkEf0V7vbnur-NfCjZPKZb%3DZfAXSV1ORw%40mail.gmail.com
This commit is contained in:
Thomas Munro
2023-07-09 11:55:03 +12:00
parent e9f15bc9db
commit 8d9a9f034e
12 changed files with 46 additions and 169 deletions

View File

@ -2283,17 +2283,13 @@ else
cdata.set('STRERROR_R_INT', false)
endif
# Check for the locale_t type and find the right header file. macOS
# needs xlocale.h; standard is locale.h, but glibc also has an
# xlocale.h file that we should not use. MSVC has a replacement
# defined in src/include/port/win32_port.h.
if cc.has_type('locale_t', prefix: '#include <locale.h>')
cdata.set('HAVE_LOCALE_T', 1)
elif cc.has_type('locale_t', prefix: '#include <xlocale.h>')
cdata.set('HAVE_LOCALE_T', 1)
# Find the right header file for the locale_t type. macOS needs xlocale.h;
# standard is locale.h, but glibc <= 2.25 also had an xlocale.h file that
# we should not use so we check the standard header first. MSVC has a
# replacement defined in src/include/port/win32_port.h.
if not cc.has_type('locale_t', prefix: '#include <locale.h>') and \
cc.has_type('locale_t', prefix: '#include <xlocale.h>')
cdata.set('LOCALE_T_IN_XLOCALE', 1)
elif cc.get_id() == 'msvc'
cdata.set('HAVE_LOCALE_T', 1)
endif
# Check if the C compiler understands typeof or a variant. Define
@ -2489,13 +2485,6 @@ if cc.has_function('syslog', args: test_c_args) and \
endif
# MSVC has replacements defined in src/include/port/win32_port.h.
if cc.get_id() == 'msvc'
cdata.set('HAVE_WCSTOMBS_L', 1)
cdata.set('HAVE_MBSTOWCS_L', 1)
endif
# if prerequisites for unnamed posix semas aren't fulfilled, fall back to sysv
# semaphores
if sema_kind == 'unnamed_posix' and \