Skip to content

Commit f1da075

Browse files
committed
Remove configure check for _configthreadlocale().
All modern Windows systems have _configthreadlocale(). It was first introduced in msvcr80.dll from Visual Studio 2005. Historically, MinGW was stuck on even older msvcrt.dll, but added its own dummy implementation of the function when using msvcrt.dll years ago anyway, effectively rendering the configure test useless. In practice we don't encounter the dummy anymore because modern MinGW uses ucrt. Reviewed-by: Peter Eisentraut <[email protected]> Discussion: https://postgr.es/m/CWZBBRR6YA8D.8EHMDRGLCKCD%40neon.tech
1 parent 63e1098 commit f1da075

File tree

7 files changed

+5
-21
lines changed

7 files changed

+5
-21
lines changed

configure

-11
Original file line numberDiff line numberDiff line change
@@ -15821,17 +15821,6 @@ fi
1582115821

1582215822
# Win32 (really MinGW) support
1582315823
if test "$PORTNAME" = "win32"; then
15824-
for ac_func in _configthreadlocale
15825-
do :
15826-
ac_fn_c_check_func "$LINENO" "_configthreadlocale" "ac_cv_func__configthreadlocale"
15827-
if test "x$ac_cv_func__configthreadlocale" = xyes; then :
15828-
cat >>confdefs.h <<_ACEOF
15829-
#define HAVE__CONFIGTHREADLOCALE 1
15830-
_ACEOF
15831-
15832-
fi
15833-
done
15834-
1583515824
case " $LIBOBJS " in
1583615825
*" dirmod.$ac_objext "* ) ;;
1583715826
*) LIBOBJS="$LIBOBJS dirmod.$ac_objext"

configure.ac

-1
Original file line numberDiff line numberDiff line change
@@ -1820,7 +1820,6 @@ fi
18201820

18211821
# Win32 (really MinGW) support
18221822
if test "$PORTNAME" = "win32"; then
1823-
AC_CHECK_FUNCS(_configthreadlocale)
18241823
AC_LIBOBJ(dirmod)
18251824
AC_LIBOBJ(kill)
18261825
AC_LIBOBJ(open)

meson.build

-1
Original file line numberDiff line numberDiff line change
@@ -2617,7 +2617,6 @@ endif
26172617
# XXX: Might be worth conditioning some checks on the OS, to avoid doing
26182618
# unnecessary checks over and over, particularly on windows.
26192619
func_checks = [
2620-
['_configthreadlocale', {'skip': host_system != 'windows'}],
26212620
['backtrace_symbols', {'dependencies': [execinfo_dep]}],
26222621
['clock_gettime', {'dependencies': [rt_dep], 'define': false}],
26232622
['copyfile'],

src/include/pg_config.h.in

-3
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,6 @@
529529
/* Define to 1 if your compiler understands __builtin_unreachable. */
530530
#undef HAVE__BUILTIN_UNREACHABLE
531531

532-
/* Define to 1 if you have the `_configthreadlocale' function. */
533-
#undef HAVE__CONFIGTHREADLOCALE
534-
535532
/* Define to 1 if you have __cpuid. */
536533
#undef HAVE__CPUID
537534

src/interfaces/ecpg/ecpglib/descriptor.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
490490
Assert(ecpg_clocale);
491491
stmt.oldlocale = uselocale(ecpg_clocale);
492492
#else
493-
#ifdef HAVE__CONFIGTHREADLOCALE
493+
#ifdef WIN32
494494
stmt.oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
495495
#endif
496496
stmt.oldlocale = ecpg_strdup(setlocale(LC_NUMERIC, NULL), lineno);
@@ -510,7 +510,7 @@ ECPGget_desc(int lineno, const char *desc_name, int index,...)
510510
setlocale(LC_NUMERIC, stmt.oldlocale);
511511
ecpg_free(stmt.oldlocale);
512512
}
513-
#ifdef HAVE__CONFIGTHREADLOCALE
513+
#ifdef WIN32
514514
if (stmt.oldthreadlocale != -1)
515515
(void) _configthreadlocale(stmt.oldthreadlocale);
516516
#endif

src/interfaces/ecpg/ecpglib/ecpglib_extern.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ struct statement
7777
locale_t oldlocale;
7878
#else
7979
char *oldlocale;
80-
#ifdef HAVE__CONFIGTHREADLOCALE
80+
#ifdef WIN32
8181
int oldthreadlocale;
8282
#endif
8383
#endif

src/interfaces/ecpg/ecpglib/execute.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1995,7 +1995,7 @@ ecpg_do_prologue(int lineno, const int compat, const int force_indicator,
19951995
return false;
19961996
}
19971997
#else
1998-
#ifdef HAVE__CONFIGTHREADLOCALE
1998+
#ifdef WIN32
19991999
stmt->oldthreadlocale = _configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
20002000
#endif
20012001
stmt->oldlocale = ecpg_strdup(setlocale(LC_NUMERIC, NULL), lineno);
@@ -2219,7 +2219,7 @@ ecpg_do_epilogue(struct statement *stmt)
22192219
#else
22202220
if (stmt->oldlocale)
22212221
setlocale(LC_NUMERIC, stmt->oldlocale);
2222-
#ifdef HAVE__CONFIGTHREADLOCALE
2222+
#ifdef WIN32
22232223

22242224
/*
22252225
* This is a bit trickier than it looks: if we failed partway through

0 commit comments

Comments
 (0)