Hello, This is new version of changes.
First, new header file is named _mingw_locale.h instead of corecrt_wlocale.h. I also added a comment on top of _mingw_locale.h to clarify its purpose. Second, functions `_create_locale` etc. are now guarded with: ``` #if __MSVCRT_VERSION >= 0x0800 || (__MSVCRT_VERSION >= 0x0600 && _WIN32_WINNT >= 0x0600) ... #endif ``` They are now exposed for msvcr80.dll and later, and msvcrt.dll for Vista or later. This guard for msvcrt.dll aligns with other functions which use `_locale_t`; they are available in msvcrt.dll since Windows Vista. Function `_configthreadlocale` is always exposed for msvcrt.dll. Comment near the guards were also slightly changed. Third, there is one new change: logic in stub for `_configthreadlocale` was updated so it also returns -1 when an invalid parameter is passed. Previously, it would only return -1 when its only argument in `_ENABLE_PER_THREAD_LOCALE`. These changes passed CI: https://github.com/maiddaisuki/mingw-w64/actions/runs/29021022612 - Kirill Makurin
From bbc44be9e2f1eebb74c5a3dc88e40bc636d2293a Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 01/13] crt: new header file _mingw_locale.h This header file is similar to corecrt_*.h files used by MSVC, and is used to eliminate duplicating declarations from header files. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/_mingw_locale.h | 37 +++++++++++++++++++++++++++ mingw-w64-headers/crt/locale.h | 11 +------- mingw-w64-headers/crt/wchar.h | 11 +------- 3 files changed, 39 insertions(+), 20 deletions(-) create mode 100644 mingw-w64-headers/crt/_mingw_locale.h diff --git a/mingw-w64-headers/crt/_mingw_locale.h b/mingw-w64-headers/crt/_mingw_locale.h new file mode 100644 index 000000000..2de6791bc --- /dev/null +++ b/mingw-w64-headers/crt/_mingw_locale.h @@ -0,0 +1,37 @@ +/** + * This file has no copyright assigned and is placed in the Public Domain. + * This file is part of the mingw-w64 runtime package. + * No warranty is given; refer to the file DISCLAIMER.PD within this package. + */ + +#ifndef _INC_MINGW_LOCALE +#define _INC_MINGW_LOCALE + +#include <corecrt.h> + +/** + * This header file contains declarations which belong to both locale.h and + * wchar.h; it allows to avoid duplicating declarations in multiple headers. + * + * This header file is similar to corecrt_*.h header files used by MSVC, + * but since there is no corecrt_wlocale.h, we name it _mingw_locale.h instead. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _WLOCALE_DEFINED +#define _WLOCALE_DEFINED +_CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif + +#if __MSVCRT_VERSION__ >= 0xB00 +_CRTIMP _locale_t __cdecl _wcreate_locale(int _Category, const wchar_t *_Locale); +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* _INC_MINGW_LOCALE */ diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 607079c7f..88271a776 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -6,7 +6,7 @@ #ifndef _INC_LOCALE #define _INC_LOCALE -#include <crtdefs.h> +#include <_mingw_locale.h> #ifdef __cplusplus #include <stdio.h> @@ -104,15 +104,6 @@ extern "C" { /* Variant of _isleadbyte_l() function which takes codepage (instead of locale_t). */ int __cdecl __mingw_isleadbyte_cp(int c, unsigned int cp); -#ifndef _WLOCALE_DEFINED -#define _WLOCALE_DEFINED - _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); -#endif - -#if __MSVCRT_VERSION__ >= 0xB00 - _CRTIMP _locale_t __cdecl _wcreate_locale(int _Category, const wchar_t *_Locale); -#endif - #ifdef __CHAR_UNSIGNED__ /* Pull in the constructor from 'charmax.c'. */ extern int __mingw_initcharmax; diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h index 68bb5c0f4..eebe5cf0d 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -11,6 +11,7 @@ #include <corecrt_wconio.h> #include <corecrt_wstdlib.h> #include <corecrt_wctype.h> +#include <_mingw_locale.h> #if __USE_MINGW_ANSI_STDIO && !defined (__USE_MINGW_STRTOX) && !defined(_CRTBLD) #define __USE_MINGW_STRTOX 1 @@ -208,15 +209,6 @@ _CRTIMP FILE *__cdecl __acrt_iob_func(unsigned index); _CRTIMP int __cdecl _wsopen(const wchar_t *_Filename,int _OpenFlag,int _ShareFlag,...) __MINGW_ATTRIB_DEPRECATED_SEC_WARN; #endif -#ifndef _WLOCALE_DEFINED -#define _WLOCALE_DEFINED - _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); -#endif - -#if __MSVCRT_VERSION__ >= 0xB00 - _CRTIMP _locale_t __cdecl _wcreate_locale(int _Category, const wchar_t *_Locale); -#endif - #ifdef _CRT_USE_WINAPI_FAMILY_DESKTOP_APP #ifndef _WEXEC_DEFINED #define _WEXEC_DEFINED @@ -1206,4 +1198,3 @@ void __cdecl __mingw_str_free(void *ptr); #include <sec_api/wchar_s.h> #endif /* _INC_WCHAR */ - -- 2.51.0.windows.1
From cf8cf307a9322c838cc95d6a9923cde757a0dcc3 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 02/13] crt: _mingw_locale.h: remove unnecessary guards Function `_wsetlocale` is now only declared in _mingw_locale.h; there is no longer any need to guard its declaration with `_WLOCALE_DEFINED`. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/_mingw_locale.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/mingw-w64-headers/crt/_mingw_locale.h b/mingw-w64-headers/crt/_mingw_locale.h index 2de6791bc..1679c1913 100644 --- a/mingw-w64-headers/crt/_mingw_locale.h +++ b/mingw-w64-headers/crt/_mingw_locale.h @@ -21,10 +21,7 @@ extern "C" { #endif -#ifndef _WLOCALE_DEFINED -#define _WLOCALE_DEFINED _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); -#endif #if __MSVCRT_VERSION__ >= 0xB00 _CRTIMP _locale_t __cdecl _wcreate_locale(int _Category, const wchar_t *_Locale); -- 2.51.0.windows.1
From cd3623061aea9b9723cd1114b8e9e38e84aa8431 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 03/13] crt: locale.h: remove unnecessary guards `struct lconv` in only declared in locale.h; there is no need to guard its declaration with `_LCONV_DEFINED`. Constants `_{ENABLE|DISABLE}_PER_THREAD_LOCALE*` are only defined in locale.h; there is no need to guard their definitions with `_CONFIG_LOCALE_SWT`. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/locale.h | 8 -------- 1 file changed, 8 deletions(-) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 88271a776..eadfe7ba9 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -40,8 +40,6 @@ extern "C" { #define LC_MIN LC_ALL #define LC_MAX LC_TIME -#ifndef _LCONV_DEFINED -#define _LCONV_DEFINED struct lconv { char *decimal_point; char *thousands_sep; @@ -72,10 +70,6 @@ extern "C" { wchar_t* _W_negative_sign; #endif }; -#endif - -#ifndef _CONFIG_LOCALE_SWT -#define _CONFIG_LOCALE_SWT #define _ENABLE_PER_THREAD_LOCALE 0x1 #define _DISABLE_PER_THREAD_LOCALE 0x2 @@ -84,8 +78,6 @@ extern "C" { #define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 #define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 -#endif - _CRTIMP int __cdecl _configthreadlocale(int _Flag); _CRTIMP char *__cdecl setlocale(int _Category,const char *_Locale); _CRTIMP struct lconv *__cdecl localeconv(void); -- 2.51.0.windows.1
From c4d8d62d166dccfce152131daf2fee6ddd474272 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 04/13] crt: expose _wsetlocale only for msvcrt20.dll and later Function `_wsetlocale` is only available since msvcrt20.dll. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/_mingw_locale.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mingw-w64-headers/crt/_mingw_locale.h b/mingw-w64-headers/crt/_mingw_locale.h index 1679c1913..7dadb9472 100644 --- a/mingw-w64-headers/crt/_mingw_locale.h +++ b/mingw-w64-headers/crt/_mingw_locale.h @@ -21,7 +21,9 @@ extern "C" { #endif +#if __MSVCRT_VERSION__ >= 0x200 _CRTIMP wchar_t *__cdecl _wsetlocale(int _Category,const wchar_t *_Locale); +#endif #if __MSVCRT_VERSION__ >= 0xB00 _CRTIMP _locale_t __cdecl _wcreate_locale(int _Category, const wchar_t *_Locale); -- 2.51.0.windows.1
From f65e170269304d9074ff0e2cb54ab56f8a0a744f Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 05/13] crt: update logic in _configthreadlocale stub Make stub for `_configthreadlocale` return -1 when an invalid parameter is passed. Previously, it would return -1 only for `_ENABLE_PER_THREAD_LOCALE`, ignoring any other invalid values. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-crt/misc/_configthreadlocale.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/misc/_configthreadlocale.c b/mingw-w64-crt/misc/_configthreadlocale.c index 5196f1973..4c6213dc3 100644 --- a/mingw-w64-crt/misc/_configthreadlocale.c +++ b/mingw-w64-crt/misc/_configthreadlocale.c @@ -9,8 +9,10 @@ int __cdecl _configthreadlocale(int flag) { /* _ENABLE_PER_THREAD_LOCALE can't work on msvcrt.dll. */ - return flag == _ENABLE_PER_THREAD_LOCALE ? -1 : _DISABLE_PER_THREAD_LOCALE; + if (flag == 0 || flag == _DISABLE_PER_THREAD_LOCALE) { + return _DISABLE_PER_THREAD_LOCALE; + } + return -1; } int (__cdecl *__MINGW_IMP_SYMBOL(_configthreadlocale)) (int) = _configthreadlocale; - -- 2.51.0.windows.1
From 39e3fad0688154213f65208b8fe3a4610ac56095 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 06/13] crt: locale.h: re-group declarations [1/5] Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/locale.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index eadfe7ba9..5032bc750 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -30,6 +30,18 @@ extern "C" { #endif #endif +/** + * Internal CRT stuff. + */ + +#ifdef __CHAR_UNSIGNED__ +/* Pull in the constructor from 'charmax.c'. */ +extern int __mingw_initcharmax; +__MINGW_SELECTANY int* __mingw_reference_charmax = &__mingw_initcharmax; +#endif + +_CRTIMP unsigned int __cdecl ___lc_codepage_func(void); + #define LC_ALL 0 #define LC_COLLATE 1 #define LC_CTYPE 2 @@ -88,7 +100,6 @@ extern "C" { _CRTIMP _locale_t __cdecl __create_locale(int _Category,const char *_Locale); _CRTIMP void __cdecl __free_locale(_locale_t _Locale); - _CRTIMP unsigned int __cdecl ___lc_codepage_func(void); /* Get the code page that the CRT currently uses for filenames. */ unsigned int __cdecl __mingw_filename_cp(void); @@ -96,12 +107,6 @@ extern "C" { /* Variant of _isleadbyte_l() function which takes codepage (instead of locale_t). */ int __cdecl __mingw_isleadbyte_cp(int c, unsigned int cp); -#ifdef __CHAR_UNSIGNED__ -/* Pull in the constructor from 'charmax.c'. */ -extern int __mingw_initcharmax; -__MINGW_SELECTANY int* __mingw_reference_charmax = &__mingw_initcharmax; -#endif - #ifdef __cplusplus } #endif -- 2.51.0.windows.1
From 3fd5208bab7e6a401b3249d64ccc724867ce919a Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:43 +0900 Subject: [PATCH 07/13] crt: locale.h: re-group declarations [2/5] Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/locale.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 5032bc750..0420cff0b 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -42,6 +42,10 @@ __MINGW_SELECTANY int* __mingw_reference_charmax = &__mingw_initcharmax; _CRTIMP unsigned int __cdecl ___lc_codepage_func(void); +/** + * Standard C declarations. + */ + #define LC_ALL 0 #define LC_COLLATE 1 #define LC_CTYPE 2 @@ -83,6 +87,9 @@ _CRTIMP unsigned int __cdecl ___lc_codepage_func(void); #endif }; +_CRTIMP char *__cdecl setlocale(int _Category,const char *_Locale); +_CRTIMP struct lconv *__cdecl localeconv(void); + #define _ENABLE_PER_THREAD_LOCALE 0x1 #define _DISABLE_PER_THREAD_LOCALE 0x2 #define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 @@ -91,8 +98,6 @@ _CRTIMP unsigned int __cdecl ___lc_codepage_func(void); #define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 _CRTIMP int __cdecl _configthreadlocale(int _Flag); - _CRTIMP char *__cdecl setlocale(int _Category,const char *_Locale); - _CRTIMP struct lconv *__cdecl localeconv(void); _CRTIMP _locale_t __cdecl _get_current_locale(void); _CRTIMP _locale_t __cdecl _create_locale(int _Category,const char *_Locale); _CRTIMP void __cdecl _free_locale(_locale_t _Locale); -- 2.51.0.windows.1
From 9fd3e4a68508d39909fd89dfb7b62bfc39904b8f Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:44 +0900 Subject: [PATCH 08/13] crt: locale.h: re-group declarations [3/5] Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-crt/crt/crtexe.c | 1 + mingw-w64-crt/misc/_configthreadlocale.c | 2 ++ mingw-w64-headers/crt/locale.h | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c index a94f2f5d2..72918caac 100644 --- a/mingw-w64-crt/crt/crtexe.c +++ b/mingw-w64-crt/crt/crtexe.c @@ -31,6 +31,7 @@ extern IMAGE_DOS_HEADER __ImageBase; int *__cdecl __p__commode(void); +int __cdecl _configthreadlocale(int); #undef _fmode extern int _fmode; diff --git a/mingw-w64-crt/misc/_configthreadlocale.c b/mingw-w64-crt/misc/_configthreadlocale.c index 4c6213dc3..2da3b506d 100644 --- a/mingw-w64-crt/misc/_configthreadlocale.c +++ b/mingw-w64-crt/misc/_configthreadlocale.c @@ -4,6 +4,8 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ +#undef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0800 #include <locale.h> int __cdecl _configthreadlocale(int flag) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 0420cff0b..0069f74df 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -90,6 +90,17 @@ _CRTIMP unsigned int __cdecl ___lc_codepage_func(void); _CRTIMP char *__cdecl setlocale(int _Category,const char *_Locale); _CRTIMP struct lconv *__cdecl localeconv(void); +/** + * Microsoft-specific declarations: thread locales. + * + * They are available since msvcr80.dll. + */ + +/** + * FIXME: we expose `_configthreadlocale` for msvcrt.dll in order to avoid + * breaking packages which use it unconditionally (e.g. libc++). + */ +#if __MSVCRT_VERSION__ >= 0x0800 || __MSVCRT_VERSION__ == 0x0600 #define _ENABLE_PER_THREAD_LOCALE 0x1 #define _DISABLE_PER_THREAD_LOCALE 0x2 #define _ENABLE_PER_THREAD_LOCALE_GLOBAL 0x10 @@ -97,7 +108,9 @@ _CRTIMP struct lconv *__cdecl localeconv(void); #define _ENABLE_PER_THREAD_LOCALE_NEW 0x100 #define _DISABLE_PER_THREAD_LOCALE_NEW 0x200 - _CRTIMP int __cdecl _configthreadlocale(int _Flag); +_CRTIMP int __cdecl _configthreadlocale(int _Flag); +#endif + _CRTIMP _locale_t __cdecl _get_current_locale(void); _CRTIMP _locale_t __cdecl _create_locale(int _Category,const char *_Locale); _CRTIMP void __cdecl _free_locale(_locale_t _Locale); -- 2.51.0.windows.1
From dac1c8b3f460f35ade0e6e9feaab620226abba77 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:44 +0900 Subject: [PATCH 09/13] crt: locale.h: re-group declarations [4/5] Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-crt/misc/_create_locale.c | 2 ++ mingw-w64-crt/misc/_free_locale.c | 2 ++ mingw-w64-crt/misc/_get_current_locale.c | 2 ++ mingw-w64-headers/crt/locale.h | 30 +++++++++++++++++++----- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/mingw-w64-crt/misc/_create_locale.c b/mingw-w64-crt/misc/_create_locale.c index 3cdeb1ae8..ae07988c6 100644 --- a/mingw-w64-crt/misc/_create_locale.c +++ b/mingw-w64-crt/misc/_create_locale.c @@ -4,6 +4,8 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ +#undef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0800 #include <locale.h> static _locale_t __cdecl emu__create_locale(int category, const char *locale) diff --git a/mingw-w64-crt/misc/_free_locale.c b/mingw-w64-crt/misc/_free_locale.c index cd7c36317..ce707430d 100644 --- a/mingw-w64-crt/misc/_free_locale.c +++ b/mingw-w64-crt/misc/_free_locale.c @@ -4,6 +4,8 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ +#undef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0800 #include <locale.h> static void __cdecl emu__free_locale(_locale_t locale) diff --git a/mingw-w64-crt/misc/_get_current_locale.c b/mingw-w64-crt/misc/_get_current_locale.c index 97dfba684..366890441 100644 --- a/mingw-w64-crt/misc/_get_current_locale.c +++ b/mingw-w64-crt/misc/_get_current_locale.c @@ -4,6 +4,8 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ +#undef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0800 #include <locale.h> static _locale_t __cdecl emu__get_current_locale(void) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 0069f74df..726466cc2 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -111,13 +111,31 @@ _CRTIMP struct lconv *__cdecl localeconv(void); _CRTIMP int __cdecl _configthreadlocale(int _Flag); #endif - _CRTIMP _locale_t __cdecl _get_current_locale(void); - _CRTIMP _locale_t __cdecl _create_locale(int _Category,const char *_Locale); - _CRTIMP void __cdecl _free_locale(_locale_t _Locale); - _CRTIMP _locale_t __cdecl __get_current_locale(void); - _CRTIMP _locale_t __cdecl __create_locale(int _Category,const char *_Locale); - _CRTIMP void __cdecl __free_locale(_locale_t _Locale); +/** + * Microsoft-specific declarations: locale objects. + * + * They are available since msvcr80.dll. + * They are also available in msvcrt.dll since Windows 8. + */ + +/** + * FIXME: functions which use `_locale_t` objects are available in msvcrt.dll + * since Windows Vista, while `_create_locale` etc. are only available since + * Windows 8. We expose them for Vista and later in order to avoid breaking + * packages which use them unconditionally (e.g. libc++). + */ +#if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600) +_CRTIMP _locale_t __cdecl _get_current_locale(void); +_CRTIMP _locale_t __cdecl _create_locale(int _Category,const char *_Locale); +_CRTIMP void __cdecl _free_locale(_locale_t _Locale); +/** + * Aliases with two underscores are deprecated; do not use in new code. + */ +_CRTIMP _locale_t __cdecl __get_current_locale(void); +_CRTIMP _locale_t __cdecl __create_locale(int _Category,const char *_Locale); +_CRTIMP void __cdecl __free_locale(_locale_t _Locale); +#endif /* Get the code page that the CRT currently uses for filenames. */ unsigned int __cdecl __mingw_filename_cp(void); -- 2.51.0.windows.1
From 6f5784c49b8825a71b81ea14d7754973af651f84 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:44 +0900 Subject: [PATCH 10/13] crt: locale.h: re-group declarations [5/5] Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/locale.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 726466cc2..00861d944 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -137,11 +137,15 @@ _CRTIMP _locale_t __cdecl __create_locale(int _Category,const char *_Locale); _CRTIMP void __cdecl __free_locale(_locale_t _Locale); #endif - /* Get the code page that the CRT currently uses for filenames. */ - unsigned int __cdecl __mingw_filename_cp(void); +/** + * mingw-w64's private functions. + */ + +/* Get the code page that the CRT currently uses for filenames. */ +unsigned int __cdecl __mingw_filename_cp(void); - /* Variant of _isleadbyte_l() function which takes codepage (instead of locale_t). */ - int __cdecl __mingw_isleadbyte_cp(int c, unsigned int cp); +/* Variant of _isleadbyte_l() function which takes codepage (instead of locale_t). */ +int __cdecl __mingw_isleadbyte_cp(int c, unsigned int cp); #ifdef __cplusplus } -- 2.51.0.windows.1
From afdb596ff6b8ff09a3562aad3ab02e270bbcd5c1 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:44 +0900 Subject: [PATCH 11/13] crt: locale.h: fix `struct lconv` declaration The _W_* members were added in 8a77639cdabe8370e225a4022e9391b9fc20bd12, which states that they are available since msvcr100.dll, and in msvcrt.dll since Windows 7. The `_WIN32_WINNT >= 0x601` check is incorrect as it ends up exposung those _W_* members for all CRTs instead of msvcrt.dll only. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/locale.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 00861d944..514f35b02 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -75,7 +75,11 @@ _CRTIMP unsigned int __cdecl ___lc_codepage_func(void); char n_sep_by_space; char p_sign_posn; char n_sign_posn; -#if __MSVCRT_VERSION__ >= 0xA00 || _WIN32_WINNT >= 0x601 + /** + * These _W_* members are available since msvcr100.dll; + * they are also available in msvcrt.dll since Windows 7. + */ +#if __MSVCRT_VERSION__ >= 0xA00 || (__MSVCRT_VERSION__ == 0x600 && _WIN32_WINNT >= 0x601) wchar_t* _W_decimal_point; wchar_t* _W_thousands_sep; wchar_t* _W_int_curr_symbol; -- 2.51.0.windows.1
From 811ea48d3f2831f0279c5a1c7a4450173c4ae13a Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:44 +0900 Subject: [PATCH 12/13] crt: locale.h: fix typo Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/locale.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 514f35b02..f0abe70a6 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -148,7 +148,7 @@ _CRTIMP void __cdecl __free_locale(_locale_t _Locale); /* Get the code page that the CRT currently uses for filenames. */ unsigned int __cdecl __mingw_filename_cp(void); -/* Variant of _isleadbyte_l() function which takes codepage (instead of locale_t). */ +/* Variant of _isleadbyte_l() function which takes codepage (instead of _locale_t). */ int __cdecl __mingw_isleadbyte_cp(int c, unsigned int cp); #ifdef __cplusplus -- 2.51.0.windows.1
From 1f455ba8f9f5d4f7e8a5629e66323fd77f7cecfe Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Thu, 9 Jul 2026 22:20:45 +0900 Subject: [PATCH 13/13] crt: move source files for locale.h functions to locale subdirectory Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-crt/Makefile.am | 26 +++++++++---------- .../{misc => locale}/___lc_codepage_func.c | 0 .../___lc_codepage_func_emul.c | 0 .../{misc => locale}/___lc_handle_func.c | 0 .../{misc => locale}/_configthreadlocale.c | 0 .../{misc => locale}/_create_locale.c | 0 mingw-w64-crt/{misc => locale}/_free_locale.c | 0 .../{misc => locale}/_get_current_locale.c | 0 8 files changed, 13 insertions(+), 13 deletions(-) rename mingw-w64-crt/{misc => locale}/___lc_codepage_func.c (100%) rename mingw-w64-crt/{misc => locale}/___lc_codepage_func_emul.c (100%) rename mingw-w64-crt/{misc => locale}/___lc_handle_func.c (100%) rename mingw-w64-crt/{misc => locale}/_configthreadlocale.c (100%) rename mingw-w64-crt/{misc => locale}/_create_locale.c (100%) rename mingw-w64-crt/{misc => locale}/_free_locale.c (100%) rename mingw-w64-crt/{misc => locale}/_get_current_locale.c (100%) diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 443f6686d..592ccafc4 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -349,12 +349,12 @@ src_msvcrt=\ ctype/iswprint.c \ ctype/wctrans.c \ ctype/wctype.c \ + locale/_configthreadlocale.c \ misc/__sys_errlist.c \ misc/__sys_nerr.c \ misc/_aligned_msize.c \ misc/_aligned_offset_recalloc.c \ misc/_aligned_recalloc.c \ - misc/_configthreadlocale.c \ misc/_get_daylight.c \ misc/_get_dstbias.c \ misc/_get_pgmptr.c \ @@ -575,14 +575,17 @@ src_msvcrt32=\ $(src_msvcrt_add_x86) \ ctype/__pctype_func.c \ ctype/__pwctype_func.c \ + locale/___lc_codepage_func.c \ + locale/___lc_handle_func.c \ + locale/_create_locale.c \ + locale/_free_locale.c \ + locale/_get_current_locale.c \ misc/msvcrt__getmainargs.c \ misc/msvcrt__wgetmainargs.c \ misc/i386__XcptFilter.c \ misc/i386__beginthread.c \ misc/i386__beginthreadex.c \ math/i386__copysignf.c \ - misc/___lc_codepage_func.c \ - misc/___lc_handle_func.c \ misc/___mb_cur_max_func.c \ misc/__p__osplatform.c \ misc/_aligned_free.c \ @@ -590,13 +593,10 @@ src_msvcrt32=\ misc/_aligned_offset_malloc.c \ misc/_aligned_offset_realloc.c \ misc/_aligned_realloc.c \ - misc/_create_locale.c \ misc/_ctime64.c \ misc/_difftime64.c \ - misc/_free_locale.c \ misc/_ftime64.c \ misc/_futime64.c \ - misc/_get_current_locale.c \ misc/_get_doserrno.c \ misc/_get_fmode.c \ misc/_gmtime64.c \ @@ -650,6 +650,9 @@ src_msvcrt64=\ $(src_msvcrt_add_x86) \ ctype/__p__pctype.c \ ctype/__p__pwctype.c \ + locale/_create_locale.c \ + locale/_free_locale.c \ + locale/_get_current_locale.c \ misc/__daylight.c \ misc/__dstbias.c \ misc/__p___argc.c \ @@ -675,9 +678,6 @@ src_msvcrt64=\ misc/__p__wpgmptr.c \ misc/__timezone.c \ misc/__tzname.c \ - misc/_create_locale.c \ - misc/_free_locale.c \ - misc/_get_current_locale.c \ misc/_get_doserrno.c \ misc/_get_fmode.c \ misc/_initterm_e.c \ @@ -935,7 +935,7 @@ src_pre_msvcrt40=\ stdio/fsetpos.c src_pre_msvcrt60=\ - misc/___lc_codepage_func_emul.c \ + locale/___lc_codepage_func_emul.c \ misc/__badioinfo.c \ misc/__p__osplatform_emul.c \ stdio/atoll.c \ @@ -982,12 +982,12 @@ src_pre_msvcr71=\ src_pre_msvcr80=\ ctype/__iswcsym.c \ ctype/__iswcsymf.c \ + locale/_configthreadlocale.c \ misc/__sys_errlist.c \ misc/__sys_nerr.c \ misc/_aligned_msize.c \ misc/_aligned_offset_recalloc.c \ misc/_aligned_recalloc.c \ - misc/_configthreadlocale.c \ misc/_difftime64.c \ misc/_get_daylight.c \ misc/_get_doserrno.c \ @@ -1148,8 +1148,8 @@ src_msvcrtd=\ $(src_pre_msvcr100) \ $(src_pre_msvcr110) \ $(src_pre_msvcr120) \ - misc/___lc_codepage_func.c \ - misc/___lc_handle_func.c \ + locale/___lc_codepage_func.c \ + locale/___lc_handle_func.c \ misc/msvcrt__getmainargs.c \ misc/msvcrt__wgetmainargs.c diff --git a/mingw-w64-crt/misc/___lc_codepage_func.c b/mingw-w64-crt/locale/___lc_codepage_func.c similarity index 100% rename from mingw-w64-crt/misc/___lc_codepage_func.c rename to mingw-w64-crt/locale/___lc_codepage_func.c diff --git a/mingw-w64-crt/misc/___lc_codepage_func_emul.c b/mingw-w64-crt/locale/___lc_codepage_func_emul.c similarity index 100% rename from mingw-w64-crt/misc/___lc_codepage_func_emul.c rename to mingw-w64-crt/locale/___lc_codepage_func_emul.c diff --git a/mingw-w64-crt/misc/___lc_handle_func.c b/mingw-w64-crt/locale/___lc_handle_func.c similarity index 100% rename from mingw-w64-crt/misc/___lc_handle_func.c rename to mingw-w64-crt/locale/___lc_handle_func.c diff --git a/mingw-w64-crt/misc/_configthreadlocale.c b/mingw-w64-crt/locale/_configthreadlocale.c similarity index 100% rename from mingw-w64-crt/misc/_configthreadlocale.c rename to mingw-w64-crt/locale/_configthreadlocale.c diff --git a/mingw-w64-crt/misc/_create_locale.c b/mingw-w64-crt/locale/_create_locale.c similarity index 100% rename from mingw-w64-crt/misc/_create_locale.c rename to mingw-w64-crt/locale/_create_locale.c diff --git a/mingw-w64-crt/misc/_free_locale.c b/mingw-w64-crt/locale/_free_locale.c similarity index 100% rename from mingw-w64-crt/misc/_free_locale.c rename to mingw-w64-crt/locale/_free_locale.c diff --git a/mingw-w64-crt/misc/_get_current_locale.c b/mingw-w64-crt/locale/_get_current_locale.c similarity index 100% rename from mingw-w64-crt/misc/_get_current_locale.c rename to mingw-w64-crt/locale/_get_current_locale.c -- 2.51.0.windows.1
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
