I just pushed them to my fork to run through CI[1]; I don't expect any issues with these few patches.
The last patch is unrelated to __is[w]csym[f][_l] functions, but it fits with recent changes. - Kirill Makurin [1] https://github.com/maiddaisuki/mingw-w64/actions/runs/21313123713
From 07124765276bec42c1089780fbdd7a6b61e64e05 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Sat, 24 Jan 2026 18:38:31 +0900 Subject: [PATCH 1/4] headers: ctype.h: move __iswcsym[f] and _iswcsym[f]_l to corecrt_wctype.h While Microsoft documentation[1] claims that they are only declared in ctype.h, MSVC header files provide them through corecrt_wctype.h. Function declarations were already in corecrt_wctype.h, while their macro versions were only in ctype.h; move macro versions to corecrt_wctype.h so they are available when including either ctype.h or wctype.h. [1] https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/iscsym-functions Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/corecrt_wctype.h | 9 ++++++++- mingw-w64-headers/crt/ctype.h | 8 ++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mingw-w64-headers/crt/corecrt_wctype.h b/mingw-w64-headers/crt/corecrt_wctype.h index a81b27103..ef45a8185 100644 --- a/mingw-w64-headers/crt/corecrt_wctype.h +++ b/mingw-w64-headers/crt/corecrt_wctype.h @@ -152,7 +152,9 @@ _CRTIMP int __cdecl isleadbyte(int _C); #endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */ #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus) -#define iswascii(_c) ((unsigned)(_c) < 0x80) +#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) +#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) +#define iswascii(_c) ((unsigned)(_c) < 0x80) #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */ /** @@ -165,6 +167,11 @@ _CRTIMP int __cdecl isleadbyte(int _C); #if __MSVCRT_VERSION__ >= 0x0800 _CRTIMP int __cdecl _iswcsym_l(wint_t _C,_locale_t _Locale); _CRTIMP int __cdecl _iswcsymf_l(wint_t _C,_locale_t _Locale); + +#if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus) +#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) +#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) +#endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */ #endif /* These are also available in msvcrt.dll since Windows Vista. */ diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index 53a0e3b72..a33f1952d 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h @@ -134,8 +134,6 @@ _CRTIMP int __cdecl __iscsymf(int _C); #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus) #define __iscsym(_c) (isalnum(_c) || ((_c)=='_')) #define __iscsymf(_c) (isalpha(_c) || ((_c)=='_')) -#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_')) -#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_')) #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */ #ifndef NO_OLDNAMES @@ -159,10 +157,8 @@ _CRTIMP int __cdecl iscsymf(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005; _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus) -#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) -#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) -#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_')) -#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_')) +#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) +#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_')) #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */ #endif -- 2.51.0.windows.1
From 7df30952bfc21daf229fb283778831a177341314 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Sat, 24 Jan 2026 18:39:58 +0900 Subject: [PATCH 2/4] crt: provide _iscsym[f]_l functions as externals _iscsym_l and _iscsymf_l are only available as macros in Microsoft headers. These macros are not exposed under the following conditions: - when _CTYPE_DISABLE_MACROS is defined; this is what Microsoft headers do - for C++ compilations; this avoids possible clashes with class member names This will result in compilation error with C++ or if _CTYPE_DISABLE_MACROS macro is defined. To avoid this, provide both functions as externals. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-crt/Makefile.am | 4 ++++ mingw-w64-crt/misc/_iscsym_l.c | 22 ++++++++++++++++++++++ mingw-w64-crt/misc/_iscsymf_l.c | 22 ++++++++++++++++++++++ mingw-w64-headers/crt/ctype.h | 21 ++++++++++++++++++--- 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 mingw-w64-crt/misc/_iscsym_l.c create mode 100644 mingw-w64-crt/misc/_iscsymf_l.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index 6810e6df2..c2a9e95e9 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -436,6 +436,8 @@ src_ucrtbase=\ misc/__p__osver_emul.c \ misc/__initenv.c \ misc/__winitenv.c \ + misc/_iscsym_l.c \ + misc/_iscsymf_l.c \ misc/_onexit.c \ misc/output_format.c \ misc/ucrt-access.c \ @@ -1042,6 +1044,8 @@ src_pre_msvcr120_post_msvcr71=\ misc/_iswblank_l.c src_post_msvcr71=\ + misc/_iscsym_l.c \ + misc/_iscsymf_l.c \ stdio/msvcr80plus_ftruncate64.c \ string/msvcr80plus_wcstok.c diff --git a/mingw-w64-crt/misc/_iscsym_l.c b/mingw-w64-crt/misc/_iscsym_l.c new file mode 100644 index 000000000..f2aab0460 --- /dev/null +++ b/mingw-w64-crt/misc/_iscsym_l.c @@ -0,0 +1,22 @@ +/** + * 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. + */ + +#undef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0800 + +#define _CTYPE_DISABLE_MACROS +#include <ctype.h> + +/** + * See ctype.h for rationale. + * + * Note that import symbol __MINGW_IMP_SYMBOL(_iscsym_l) is not provided on + * purpose. + */ + +int __cdecl _iscsym_l (wint_t _C, _locale_t _Locale) { + return (_isalnum_l (_C, _Locale) || _C == '_'); +} diff --git a/mingw-w64-crt/misc/_iscsymf_l.c b/mingw-w64-crt/misc/_iscsymf_l.c new file mode 100644 index 000000000..45aa8848c --- /dev/null +++ b/mingw-w64-crt/misc/_iscsymf_l.c @@ -0,0 +1,22 @@ +/** + * 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. + */ + +#undef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0800 + +#define _CTYPE_DISABLE_MACROS +#include <ctype.h> + +/** + * See ctype.h for rationale. + * + * Note that import symbol __MINGW_IMP_SYMBOL(_iscsymf_l) is not provided on + * purpose. + */ + +int __cdecl _iscsymf_l (wint_t _C, _locale_t _Locale) { + return (_isalpha_l (_C, _Locale) || _C == '_'); +} diff --git a/mingw-w64-headers/crt/ctype.h b/mingw-w64-headers/crt/ctype.h index a33f1952d..86f7f86d7 100644 --- a/mingw-w64-headers/crt/ctype.h +++ b/mingw-w64-headers/crt/ctype.h @@ -152,9 +152,19 @@ _CRTIMP int __cdecl iscsymf(int _C) __MINGW_ATTRIB_DEPRECATED_MSVC2005; * They are available since msvcr80.dll. */ -/* These are also available in msvcrt.dll since Windows Vista. */ -#if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600) -_CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); +/** + * _iscsym_l and _iscsymf_l are only available as macros in Microsoft headers. + * + * We do not expose those macros under following conditions: + * + * - when _CTYPE_DISABLE_MACROS is defined; this is what Microsoft headers do + * - for C++ compilations; this avoids possible clashes with class member names + * + * To make them available under above conditions, we provide them as externals. + */ +#if __MSVCRT_VERSION__ >= 0x0800 +int __cdecl _iscsym_l(wint_t _C, _locale_t _Locale); +int __cdecl _iscsymf_l(wint_t _C, _locale_t _Locale); #if !defined(_CTYPE_DISABLE_MACROS) && !defined(__cplusplus) #define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_')) @@ -162,6 +172,11 @@ _CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); #endif /* !_CTYPE_DISABLE_MACROS && !__cplusplus */ #endif +/* These are also available in msvcrt.dll since Windows Vista. */ +#if __MSVCRT_VERSION__ >= 0x0800 || (__MSVCRT_VERSION__ == 0x0600 && _WIN32_WINNT >= 0x0600) +_CRTIMP int __cdecl _isctype_l(int _C,int _Type,_locale_t _Locale); +#endif + #ifdef __cplusplus } #endif -- 2.51.0.windows.1
From 67170e78340bd381ea4c1e8f52aa59a08afcfa9f Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Sat, 24 Jan 2026 18:40:25 +0900 Subject: [PATCH 3/4] crt: tidy-up __iswcsym.c and __iswcsymf.c Include wctype.h instead of declaring functions in source files. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-crt/misc/__iswcsym.c | 9 ++------- mingw-w64-crt/misc/__iswcsymf.c | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/mingw-w64-crt/misc/__iswcsym.c b/mingw-w64-crt/misc/__iswcsym.c index 74d9e7ffd..25d45a4a0 100644 --- a/mingw-w64-crt/misc/__iswcsym.c +++ b/mingw-w64-crt/misc/__iswcsym.c @@ -4,14 +4,9 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <_mingw.h> -#include <corecrt.h> +#define _CTYPE_DISABLE_MACROS +#include <wctype.h> -#undef iswalnum -_CRTIMP int __cdecl iswalnum(wint_t c); - -#undef __iswcsym -int __cdecl __iswcsym(wint_t c); int __cdecl __iswcsym(wint_t c) { return iswalnum(c) || c == L'_'; diff --git a/mingw-w64-crt/misc/__iswcsymf.c b/mingw-w64-crt/misc/__iswcsymf.c index 18a234a0b..eaa7e7f62 100644 --- a/mingw-w64-crt/misc/__iswcsymf.c +++ b/mingw-w64-crt/misc/__iswcsymf.c @@ -4,14 +4,9 @@ * No warranty is given; refer to the file DISCLAIMER.PD within this package. */ -#include <_mingw.h> -#include <corecrt.h> +#define _CTYPE_DISABLE_MACROS +#include <wctype.h> -#undef iswalpha -_CRTIMP int __cdecl iswalpha(wint_t c); - -#undef __iswcsymf -int __cdecl __iswcsymf(wint_t c); int __cdecl __iswcsymf(wint_t c) { return iswalpha(c) || c == L'_'; -- 2.51.0.windows.1
From e9d16b10fbeceb521eae298231845762a2c193b0 Mon Sep 17 00:00:00 2001 From: Kirill Makurin <[email protected]> Date: Sat, 24 Jan 2026 18:40:48 +0900 Subject: [PATCH 4/4] headers: corecrt_wctype.h: remove unnecessary guards Both wint_t and wctype_t are defined in corecrt.h which is always included from all corecrt_w*.h header files. Signed-off-by: Kirill Makurin <[email protected]> --- mingw-w64-headers/crt/corecrt_wctype.h | 6 ------ 1 file changed, 6 deletions(-) diff --git a/mingw-w64-headers/crt/corecrt_wctype.h b/mingw-w64-headers/crt/corecrt_wctype.h index ef45a8185..33798b2ba 100644 --- a/mingw-w64-headers/crt/corecrt_wctype.h +++ b/mingw-w64-headers/crt/corecrt_wctype.h @@ -12,12 +12,6 @@ extern "C" { #endif -#ifndef _WCTYPE_T_DEFINED -#define _WCTYPE_T_DEFINED - typedef unsigned short wint_t; - typedef unsigned short wctype_t; -#endif /* _WCTYPE_T_DEFINED */ - #ifndef WEOF #define WEOF (wint_t)(0xFFFF) #endif -- 2.51.0.windows.1
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
