Hello, This patch series cleans up and de-duplicates declarations in locale.h.
I wanted to send these changes a month ago, but I ran into issues I described in my "libc++ unconditionally uses _create_locale, _configthraedlocale and friends?" message back in May. I hoped to find time to fix those issues in libc++, but in the end these changes were just laying around in my local git tree ever since. So, instead, I simply modified them to keep exposing _configthreadlocale, _create_locale and friends for msvcrt.dll, so we do not break libc++ builds and possibly some other packages which use those functions unconditionally. This really should be fixed in libc++, but I guess another time. It would be a great help if anyone could look into fixing usage of these functions in libc++. These changes passed CI: https://github.com/maiddaisuki/mingw-w64/actions/runs/28016291963 - Kirill Makurin
From 58c31e53c53a295305469c5c047b9088aedbc11c Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:30 +0900 Subject: [PATCH 01/12] crt: new header file corecrt_wlocale.h Similar to other corecrt_w*.h files, it is used to eliminate duplicating declarations from header files. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/corecrt_wlocale.h | 29 +++++++++++++++++++++++++ mingw-w64-headers/crt/locale.h | 11 +--------- mingw-w64-headers/crt/wchar.h | 10 +-------- 3 files changed, 31 insertions(+), 19 deletions(-) create mode 100644 mingw-w64-headers/crt/corecrt_wlocale.h diff --git a/mingw-w64-headers/crt/corecrt_wlocale.h b/mingw-w64-headers/crt/corecrt_wlocale.h new file mode 100644 index 000000000..6c93ee4d6 --- /dev/null +++ b/mingw-w64-headers/crt/corecrt_wlocale.h @@ -0,0 +1,29 @@ +/** + * 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_CORECRT_WLOCALE +#define _INC_CORECRT_WLOCALE + +#include <corecrt.h> + +#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 diff --git a/mingw-w64-headers/crt/locale.h b/mingw-w64-headers/crt/locale.h index 607079c7f..3e0f56fe5 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 <corecrt_wlocale.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..e8672457f 100644 --- a/mingw-w64-headers/crt/wchar.h +++ b/mingw-w64-headers/crt/wchar.h @@ -9,6 +9,7 @@ #include <corecrt.h> #include <corecrt_stdio_config.h> #include <corecrt_wconio.h> +#include <corecrt_wlocale.h> #include <corecrt_wstdlib.h> #include <corecrt_wctype.h> @@ -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 -- 2.51.0.windows.1
From cd05d5339b11a70f615eabf5aa90d178534c9184 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 02/12] crt: corecrt_wlocale.h: remove unnecessary guards Function `_wsetlocale` is now only declared in corecrt_wlocale.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/corecrt_wlocale.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/mingw-w64-headers/crt/corecrt_wlocale.h b/mingw-w64-headers/crt/corecrt_wlocale.h index 6c93ee4d6..243947f4b 100644 --- a/mingw-w64-headers/crt/corecrt_wlocale.h +++ b/mingw-w64-headers/crt/corecrt_wlocale.h @@ -13,10 +13,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 ba734885624377b32058b9bd14b1a72ad9c3c849 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 03/12] 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 3e0f56fe5..c2473701a 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 9e4b46437f94b7a7b317e04a88f743fb563442e3 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 04/12] 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/corecrt_wlocale.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mingw-w64-headers/crt/corecrt_wlocale.h b/mingw-w64-headers/crt/corecrt_wlocale.h index 243947f4b..95bf2dcab 100644 --- a/mingw-w64-headers/crt/corecrt_wlocale.h +++ b/mingw-w64-headers/crt/corecrt_wlocale.h @@ -13,7 +13,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 efec364e3002f742e2528ffbc7750df910c48c98 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 05/12] 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 c2473701a..00075d87a 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 5e74eaee44c95d149d52b13d11bfaa41ff9a1fdf Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 06/12] 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 00075d87a..c86cbb1fb 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 bf0865628a1b1d65708ee7e22ccc2a2a8a4fd7d8 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 07/12] 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 | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c index 86c3842f6..06154aa2d 100644 --- a/mingw-w64-crt/crt/crtexe.c +++ b/mingw-w64-crt/crt/crtexe.c @@ -36,6 +36,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 5196f1973..90b4619c8 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 c86cbb1fb..67a78cce5 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: for now, 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); @@ -105,7 +118,6 @@ _CRTIMP struct lconv *__cdecl localeconv(void); _CRTIMP _locale_t __cdecl __create_locale(int _Category,const char *_Locale); _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); -- 2.51.0.windows.1
From 9a10c9250b9337b08d583f9ce267ea6e1c2f3613 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 08/12] 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 | 29 +++++++++++++++++++----- 4 files changed, 29 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 67a78cce5..f5679e837 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -111,12 +111,29 @@ _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: for now, we always expose these function for msvcrt.dll in order + * to avoid breaking packages which use it unconditionally (e.g. libc++). + */ +#if __MSVCRT_VERSION__ >= 0x0800 || __MSVCRT_VERSION__ == 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 64f23159c0d5b4230bd53c9aad9724047f7e4535 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 09/12] 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 f5679e837..b1ef37764 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -135,11 +135,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 extensions. + */ + +/* 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 43b925db1bc722480ed65a0536c70cd489d13403 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:31 +0900 Subject: [PATCH 10/12] 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 b1ef37764..3591b7879 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 ed94abcaf7a4b4161501309c03b5ec81f0bd8e1a Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:32 +0900 Subject: [PATCH 11/12] 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 3591b7879..1915aea45 100644 --- a/mingw-w64-headers/crt/locale.h +++ b/mingw-w64-headers/crt/locale.h @@ -146,7 +146,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 10f8a4b6fcc909f64f207fcefd3ddf0de63bb484 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Tue, 23 Jun 2026 18:26:32 +0900 Subject: [PATCH 12/12] 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 b651dce59..569b759fc 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -348,12 +348,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 \ @@ -574,14 +574,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 \ @@ -589,13 +592,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 \ @@ -649,6 +649,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 \ @@ -674,9 +677,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 \ @@ -934,7 +934,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 \ @@ -981,12 +981,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 \ @@ -1147,8 +1147,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
