4 new patches are attached. This should be the final round of wchar.h split.
I'll cleanup wchar_s.h similarly later.
From d2cd48553b9f323ba45f76e4f7c75b8c0046f208 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Mon, 17 Aug 2026 18:04:17 +0800
Subject: [PATCH 1/4] headers: crt: split out corecrt_wdirect.h
Also removed _WDIRECT_DEFINED.
Signed-off-by: Zhongteng Gui <[email protected]>
---
mingw-w64-headers/crt/corecrt_wdirect.h | 37 +++++++++++++++++++++++++
mingw-w64-headers/crt/direct.h | 26 +----------------
mingw-w64-headers/crt/wchar.h | 27 +-----------------
3 files changed, 39 insertions(+), 51 deletions(-)
create mode 100644 mingw-w64-headers/crt/corecrt_wdirect.h
diff --git a/mingw-w64-headers/crt/corecrt_wdirect.h
b/mingw-w64-headers/crt/corecrt_wdirect.h
new file mode 100644
index 000000000..5519f8aea
--- /dev/null
+++ b/mingw-w64-headers/crt/corecrt_wdirect.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_CORECRT_WDIRECT
+#define _INC_CORECRT_WDIRECT
+
+#include <corecrt.h>
+
+_CRT_BEGIN_C_HEADER
+
+#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+#pragma push_macro("_wgetcwd")
+#undef _wgetcwd
+#pragma push_macro("_wgetdcwd")
+#undef _wgetdcwd
+#pragma push_macro("_wgetdcwd_nolock")
+#undef _wgetdcwd_nolock
+#endif
+ _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
+ _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int
_SizeInWords);
+#if __MSVCRT_VERSION__ >= 0x800
+ wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int
_SizeInWords);
+#endif
+#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+#pragma pop_macro("_wgetcwd")
+#pragma pop_macro("_wgetdcwd")
+#pragma pop_macro("_wgetdcwd_nolock")
+#endif
+ _CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
+ _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
+ _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
+
+_CRT_END_C_HEADER
+
+#endif /* _INC_CORECRT_WDIRECT */
diff --git a/mingw-w64-headers/crt/direct.h b/mingw-w64-headers/crt/direct.h
index f1a3983cb..660b05e25 100644
--- a/mingw-w64-headers/crt/direct.h
+++ b/mingw-w64-headers/crt/direct.h
@@ -8,6 +8,7 @@
#include <crtdefs.h>
#include <io.h>
+#include <corecrt_wdirect.h>
_CRT_BEGIN_C_HEADER
@@ -53,31 +54,6 @@ _CRT_BEGIN_C_HEADER
#endif
#endif /* _CRT_USE_WINAPI_FAMILY_DESKTOP_APP */
-#ifndef _WDIRECT_DEFINED
-#define _WDIRECT_DEFINED
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma push_macro("_wgetcwd")
-#undef _wgetcwd
-#pragma push_macro("_wgetdcwd")
-#undef _wgetdcwd
-#pragma push_macro("_wgetdcwd_nolock")
-#undef _wgetdcwd_nolock
-#endif
- _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
- _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int
_SizeInWords);
-#if __MSVCRT_VERSION__ >= 0x800
- wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int
_SizeInWords);
-#endif
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma pop_macro("_wgetcwd")
-#pragma pop_macro("_wgetdcwd")
-#pragma pop_macro("_wgetdcwd_nolock")
-#endif
- _CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
- _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
- _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
-#endif
-
#ifndef NO_OLDNAMES
#define diskfree_t _diskfree_t
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 705f15317..13d9882e2 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -9,6 +9,7 @@
#include <corecrt.h>
#include <corecrt_wconio.h>
#include <corecrt_wctype.h>
+#include <corecrt_wdirect.h>
#include <corecrt_wio.h>
#include <corecrt_wprocess.h>
#include <corecrt_wstdio.h>
@@ -28,32 +29,6 @@ _CRT_BEGIN_C_HEADER
#define WCHAR_MAX 0xffffU
#endif
-#ifndef _WDIRECT_DEFINED
-#define _WDIRECT_DEFINED
-
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma push_macro("_wgetcwd")
-#undef _wgetcwd
-#pragma push_macro("_wgetdcwd")
-#undef _wgetdcwd
-#pragma push_macro("_wgetdcwd_nolock")
-#undef _wgetdcwd_nolock
-#endif
- _CRTIMP wchar_t *__cdecl _wgetcwd(wchar_t *_DstBuf,int _SizeInWords);
- _CRTIMP wchar_t *__cdecl _wgetdcwd(int _Drive,wchar_t *_DstBuf,int
_SizeInWords);
-#if __MSVCRT_VERSION__ >= 0x800
- wchar_t *__cdecl _wgetdcwd_nolock(int _Drive,wchar_t *_DstBuf,int
_SizeInWords);
-#endif
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma pop_macro("_wgetcwd")
-#pragma pop_macro("_wgetdcwd")
-#pragma pop_macro("_wgetdcwd_nolock")
-#endif
- _CRTIMP int __cdecl _wchdir(const wchar_t *_Path);
- _CRTIMP int __cdecl _wmkdir(const wchar_t *_Path);
- _CRTIMP int __cdecl _wrmdir(const wchar_t *_Path);
-#endif
-
#if !defined(_POSIX_) || defined(__GNUC__)
#ifndef _INO_T_DEFINED
#define _INO_T_DEFINED
--
2.55.0.windows.4
From b5a2d0364f0cefbd0d2032bed015f8afe515867b Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Mon, 17 Aug 2026 18:20:21 +0800
Subject: [PATCH 2/4] headers: crt: split out corecrt_wstdlib.h
This one is slightly different from others, because corecrt_wstdlib.h
existed before, and the rest declartions in stdlib.h and wchar.h are
slightly different. Specifically:
1. _ui64tow lacks __MINGW_ATTRIB_DEPRECATED_SEC_WARN in wchar.h
2. wchar.h lacks _wcstof_l
3. _wputenv is declared without guard in stdlib.h, but under !_POSIX_ in
wchar.h
This commit follows stdlib.h for these.
Also removed _WSTDLIB_DEFINED and _WSTDLIBP_DEFINED.
Signed-off-by: Zhongteng Gui <[email protected]>
---
mingw-w64-headers/crt/corecrt_wstdlib.h | 72 +++++++++++++++++++++++
mingw-w64-headers/crt/stdlib.h | 76 ------------------------
mingw-w64-headers/crt/wchar.h | 77 -------------------------
3 files changed, 72 insertions(+), 153 deletions(-)
diff --git a/mingw-w64-headers/crt/corecrt_wstdlib.h
b/mingw-w64-headers/crt/corecrt_wstdlib.h
index aa316933e..d3673cdb7 100644
--- a/mingw-w64-headers/crt/corecrt_wstdlib.h
+++ b/mingw-w64-headers/crt/corecrt_wstdlib.h
@@ -10,6 +10,78 @@
_CRT_BEGIN_C_HEADER
+ _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+ _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+ _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int
_Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+
+ double __cdecl __mingw_wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr);
+ float __cdecl __mingw_wcstof(const wchar_t * __restrict__ nptr, wchar_t **
__restrict__ endptr);
+ long double __cdecl __mingw_wcstold(const wchar_t * __restrict__, wchar_t **
__restrict__);
+
+#if defined(__USE_MINGW_STRTOX) && !defined(_UCRT)
+ __mingw_ovr
+ double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr){
+ return __mingw_wcstod(_Str,_EndPtr);
+ }
+ __mingw_ovr
+ float __cdecl wcstof(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr){
+ return __mingw_wcstof(_Str,_EndPtr);
+ }
+ /* wcstold is already a mingw implementation */
+#else
+ double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr);
+ float __cdecl wcstof(const wchar_t * __restrict__ nptr, wchar_t **
__restrict__ endptr);
+#endif /* !defined(__USE_MINGW_STRTOX) || defined(_UCRT) */
+#if !defined __NO_ISOCEXT /* in libmingwex.a */
+ long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t **
__restrict__);
+#endif /* __NO_ISOCEXT */
+ _CRTIMP double __cdecl _wcstod_l(const wchar_t * __restrict__ _Str,wchar_t
** __restrict__ _EndPtr,_locale_t _Locale);
+ _CRTIMP float __cdecl _wcstof_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,_locale_t _Locale);
+ long __cdecl wcstol(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
+ _CRTIMP long __cdecl _wcstol_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix,_locale_t _Locale);
+ unsigned long __cdecl wcstoul(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
+ _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t * __restrict__
_Str,wchar_t ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
+ _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+#ifndef _CRT_WSYSTEM_DEFINED
+#define _CRT_WSYSTEM_DEFINED
+ _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
+#endif
+ _CRTIMP double __cdecl _wtof(const wchar_t *_Str);
+ _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale);
+ _CRTIMP int __cdecl _wtoi(const wchar_t *_Str);
+ _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale);
+ _CRTIMP long __cdecl _wtol(const wchar_t *_Str);
+ _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
+
+ __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t
*_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+ __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64
_Val,wchar_t *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+ __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
+ __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t
*_Str,_locale_t _Locale);
+ __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix);
+ __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
+ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix);
+ __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const
wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
+
+ _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString);
+
+#ifndef _POSIX_
+#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+#pragma push_macro("_wfullpath")
+#undef _wfullpath
+#endif
+ _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t
*_Path,size_t _SizeInWords);
+#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
+#pragma pop_macro("_wfullpath")
+#endif
+ _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t
*_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext);
+#ifndef _CRT_WPERROR_DEFINED
+#define _CRT_WPERROR_DEFINED
+ _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
+#endif
+ _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t
*_EnvVar,wchar_t *_ResultPath) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+ _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t
*_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
+#endif
+
#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
#pragma push_macro("_wdupenv_s")
#undef _wdupenv_s
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
index 0955d42fd..0f1249adb 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -469,66 +469,9 @@ float __cdecl __MINGW_NOTHROW strtof(const char *
__restrict__ _Str,char ** __re
#pragma pop_macro("_aligned_msize")
#endif
-#endif
-
-#ifndef _WSTDLIB_DEFINED
-#define _WSTDLIB_DEFINED
-
- _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int
_Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-
- double __cdecl __mingw_wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr);
- float __cdecl __mingw_wcstof(const wchar_t * __restrict__ nptr, wchar_t **
__restrict__ endptr);
- long double __cdecl __mingw_wcstold(const wchar_t * __restrict__, wchar_t **
__restrict__);
-
-#if defined(__USE_MINGW_STRTOX) && !defined(_UCRT)
- __mingw_ovr
- double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr){
- return __mingw_wcstod(_Str,_EndPtr);
- }
- __mingw_ovr
- float __cdecl wcstof(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr){
- return __mingw_wcstof(_Str,_EndPtr);
- }
- /* wcstold is already a mingw implementation */
-#else
- double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr);
- float __cdecl wcstof(const wchar_t * __restrict__ nptr, wchar_t **
__restrict__ endptr);
-#endif /* !defined(__USE_MINGW_STRTOX) || defined(_UCRT) */
-#if !defined __NO_ISOCEXT /* in libmingwex.a */
- long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t **
__restrict__);
-#endif /* __NO_ISOCEXT */
- _CRTIMP double __cdecl _wcstod_l(const wchar_t * __restrict__ _Str,wchar_t
** __restrict__ _EndPtr,_locale_t _Locale);
- _CRTIMP float __cdecl _wcstof_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,_locale_t _Locale);
- long __cdecl wcstol(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
- _CRTIMP long __cdecl _wcstol_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix,_locale_t _Locale);
- unsigned long __cdecl wcstoul(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
- _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t * __restrict__
_Str,wchar_t ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
- _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#ifndef _CRT_WSYSTEM_DEFINED
-#define _CRT_WSYSTEM_DEFINED
- _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
-#endif
- _CRTIMP double __cdecl _wtof(const wchar_t *_Str);
- _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale);
- _CRTIMP int __cdecl _wtoi(const wchar_t *_Str);
- _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale);
- _CRTIMP long __cdecl _wtol(const wchar_t *_Str);
- _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
-
- __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t
*_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64
_Val,wchar_t *_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t
*_Str,_locale_t _Locale);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
- __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix);
- __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const
wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
#endif
_CRTIMP int __cdecl _putenv(const char *_EnvString);
- _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString);
#ifndef _POSIX_
#define _CVTBUFSIZE (309+40)
@@ -601,25 +544,6 @@ unsigned long __cdecl _lrotr(unsigned long,int);
_CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char
*_Dir,char *_Filename,char *_Ext) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
_CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
-#ifndef _WSTDLIBP_DEFINED
-#define _WSTDLIBP_DEFINED
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma push_macro("_wfullpath")
-#undef _wfullpath
-#endif
- _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t
*_Path,size_t _SizeInWords);
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma pop_macro("_wfullpath")
-#endif
- _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t
*_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext);
-#ifndef _CRT_WPERROR_DEFINED
-#define _CRT_WPERROR_DEFINED
- _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
-#endif
- _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t
*_EnvVar,wchar_t *_ResultPath) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t
*_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#endif
-
_CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration)
__MINGW_ATTRIB_DEPRECATED;
/* Not to be confused with _set_error_mode (int). */
_CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED;
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 13d9882e2..cc1b6b12f 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -59,83 +59,6 @@ _CRT_BEGIN_C_HEADER
#endif
#endif
-#ifndef _WSTDLIB_DEFINED
-#define _WSTDLIB_DEFINED
-
- _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int
_Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP double __cdecl _wcstod_l(const wchar_t * __restrict__ _Str,wchar_t
** __restrict__ _EndPtr,_locale_t _Locale);
-
- double __cdecl __mingw_wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr);
- float __cdecl __mingw_wcstof(const wchar_t * __restrict__ nptr, wchar_t **
__restrict__ endptr);
- long double __cdecl __mingw_wcstold(const wchar_t * __restrict__, wchar_t **
__restrict__);
-
-#if defined(__USE_MINGW_STRTOX) && !defined(_UCRT)
- __mingw_ovr
- double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr){
- return __mingw_wcstod(_Str,_EndPtr);
- }
- __mingw_ovr
- float __cdecl wcstof(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr){
- return __mingw_wcstof(_Str,_EndPtr);
- }
- /* wcstold is already a mingw implementation */
-#else
- double __cdecl wcstod(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr);
- float __cdecl wcstof(const wchar_t * __restrict__ nptr, wchar_t **
__restrict__ endptr);
-#endif /* !defined(__USE_MINGW_STRTOX) || defined(_UCRT) */
-#if !defined __NO_ISOCEXT /* in libmingwex.a */
- long double __cdecl wcstold (const wchar_t * __restrict__, wchar_t **
__restrict__);
-#endif /* __NO_ISOCEXT */
- long __cdecl wcstol(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
- _CRTIMP long __cdecl _wcstol_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix,_locale_t _Locale);
- unsigned long __cdecl wcstoul(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
- _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t * __restrict__
_Str,wchar_t ** __restrict__ _EndPtr,int _Radix,_locale_t _Locale);
- _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#ifndef _CRT_WSYSTEM_DEFINED
-#define _CRT_WSYSTEM_DEFINED
- _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
-#endif
- _CRTIMP double __cdecl _wtof(const wchar_t *_Str);
- _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale);
- _CRTIMP int __cdecl _wtoi(const wchar_t *_Str);
- _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale);
- _CRTIMP long __cdecl _wtol(const wchar_t *_Str);
- _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
-
- __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t
*_DstBuf,int _Radix) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64
_Val,wchar_t *_DstBuf,int _Radix);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t
*_Str,_locale_t _Locale);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix);
- __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
- __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t
*_Str,wchar_t **_EndPtr,int _Radix);
- __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const
wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
-#endif
-
-#ifndef _POSIX_
-#ifndef _WSTDLIBP_DEFINED
-#define _WSTDLIBP_DEFINED
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma push_macro("_wfullpath")
-#undef _wfullpath
-#endif
- _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t
*_Path,size_t _SizeInWords);
-#if defined(_DEBUG) && defined(_CRTDBG_MAP_ALLOC)
-#pragma pop_macro("_wfullpath")
-#endif
- _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t
*_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext);
-#ifndef _CRT_WPERROR_DEFINED
-#define _CRT_WPERROR_DEFINED
- _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
-#endif
- _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString);
- _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t
*_EnvVar,wchar_t *_ResultPath) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
- _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t
*_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext)
__MINGW_ATTRIB_DEPRECATED_SEC_WARN;
-#endif
-#endif
-
#if defined(_UCRT) || defined(__LARGE_MBSTATE_T)
typedef struct _Mbstatet {
unsigned long _Wchar;
--
2.55.0.windows.4
From 8615e81dee3fba8334c85a2be840448b119e8ab9 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Mon, 17 Aug 2026 18:36:09 +0800
Subject: [PATCH 3/4] headers: wchar.h: include sys/stat.h instead of declaring
itself
This follows UCRT headers.
Also removed _WSTAT_DEFINED. _INO_T_DEFINED and _DEV_T_DEFINED are kept
because UCRT also defined them.
Signed-off-by: Zhongteng Gui <[email protected]>
---
mingw-w64-headers/crt/sys/stat.h | 3 ---
mingw-w64-headers/crt/wchar.h | 31 +------------------------------
2 files changed, 1 insertion(+), 33 deletions(-)
diff --git a/mingw-w64-headers/crt/sys/stat.h b/mingw-w64-headers/crt/sys/stat.h
index 2255900e7..c461be56c 100644
--- a/mingw-w64-headers/crt/sys/stat.h
+++ b/mingw-w64-headers/crt/sys/stat.h
@@ -36,13 +36,10 @@ _CRT_BEGIN_C_HEADER
_CRTIMP int __cdecl _stat32i64(const char *_Name,struct _stat32i64 *_Stat);
_CRTIMP int __cdecl _stat64i32(const char *_Name,struct _stat64i32 *_Stat);
-#ifndef _WSTAT_DEFINED
-#define _WSTAT_DEFINED
_CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat);
_CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64
*_Stat);
_CRTIMP int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32
*_Stat);
_CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat);
-#endif
#ifndef NO_OLDNAMES
#define _S_IFBLK 0x6000 /* Block: Is this ever set under w32? */
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index cc1b6b12f..793509a2b 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -16,6 +16,7 @@
#include <corecrt_wstdlib.h>
#include <corecrt_wstring.h>
#include <corecrt_wtime.h>
+#include <sys/stat.h>
#include <_mingw_locale.h>
#if __USE_MINGW_ANSI_STDIO && !defined (__USE_MINGW_STRTOX) &&
!defined(_CRTBLD)
@@ -29,36 +30,6 @@ _CRT_BEGIN_C_HEADER
#define WCHAR_MAX 0xffffU
#endif
-#if !defined(_POSIX_) || defined(__GNUC__)
-#ifndef _INO_T_DEFINED
-#define _INO_T_DEFINED
- typedef unsigned short _ino_t;
-#ifndef NO_OLDNAMES
- typedef unsigned short ino_t;
-#endif
-#endif
-
-#ifndef _DEV_T_DEFINED
-#define _DEV_T_DEFINED
- typedef unsigned int _dev_t;
-#ifndef NO_OLDNAMES
- typedef unsigned int dev_t;
-#endif
-#endif
-
-#include <_mingw_off_t.h>
-#include <_mingw_stat64.h>
-
-#ifndef _WSTAT_DEFINED
-#define _WSTAT_DEFINED
-
- _CRTIMP int __cdecl _wstat32(const wchar_t *_Name,struct _stat32 *_Stat);
- _CRTIMP int __cdecl _wstat32i64(const wchar_t *_Name,struct _stat32i64
*_Stat);
- _CRTIMP int __cdecl _wstat64i32(const wchar_t *_Name,struct _stat64i32
*_Stat);
- _CRTIMP int __cdecl _wstat64(const wchar_t *_Name,struct _stat64 *_Stat);
-#endif
-#endif
-
#if defined(_UCRT) || defined(__LARGE_MBSTATE_T)
typedef struct _Mbstatet {
unsigned long _Wchar;
--
2.55.0.windows.4
From 05e2eddabc1c1c38470afe22949c91bafb0d78c2 Mon Sep 17 00:00:00 2001
From: Zhongteng Gui <[email protected]>
Date: Mon, 17 Aug 2026 18:37:30 +0800
Subject: [PATCH 4/4] headers: crt: define mbstate_t in corecrt.h
This follows UCRT headers.
Signed-off-by: Zhongteng Gui <[email protected]>
---
mingw-w64-headers/crt/corecrt.h | 10 ++++++++++
mingw-w64-headers/crt/wchar.h | 9 ---------
mingw-w64-headers/crt/yvals.h | 4 ----
3 files changed, 10 insertions(+), 13 deletions(-)
diff --git a/mingw-w64-headers/crt/corecrt.h b/mingw-w64-headers/crt/corecrt.h
index fd9aecbb2..257108d4e 100644
--- a/mingw-w64-headers/crt/corecrt.h
+++ b/mingw-w64-headers/crt/corecrt.h
@@ -141,6 +141,16 @@ typedef __time64_t time_t;
#endif
#endif /* _TIME_T_DEFINED */
+#if defined(_UCRT) || defined(__LARGE_MBSTATE_T)
+ typedef struct _Mbstatet {
+ unsigned long _Wchar;
+ unsigned short _Byte, _State;
+ } _Mbstatet;
+ typedef _Mbstatet mbstate_t;
+#else
+ typedef int mbstate_t;
+#endif
+
#ifndef _CRT_SECURE_CPP_NOTHROW
#define _CRT_SECURE_CPP_NOTHROW throw()
#endif
diff --git a/mingw-w64-headers/crt/wchar.h b/mingw-w64-headers/crt/wchar.h
index 793509a2b..56305050a 100644
--- a/mingw-w64-headers/crt/wchar.h
+++ b/mingw-w64-headers/crt/wchar.h
@@ -30,15 +30,6 @@ _CRT_BEGIN_C_HEADER
#define WCHAR_MAX 0xffffU
#endif
-#if defined(_UCRT) || defined(__LARGE_MBSTATE_T)
- typedef struct _Mbstatet {
- unsigned long _Wchar;
- unsigned short _Byte, _State;
- } _Mbstatet;
- typedef _Mbstatet mbstate_t;
-#else
- typedef int mbstate_t;
-#endif
typedef wchar_t _Wint_t;
_CRTIMP wint_t __cdecl btowc(int);
diff --git a/mingw-w64-headers/crt/yvals.h b/mingw-w64-headers/crt/yvals.h
index 4ce9d09d1..4eed84271 100644
--- a/mingw-w64-headers/crt/yvals.h
+++ b/mingw-w64-headers/crt/yvals.h
@@ -255,10 +255,6 @@ _STD_END
_C_STD_BEGIN
_CRTIMP void __cdecl _Atexit(void (__cdecl *)(void));
-#if !defined(_UCRT) && !defined(__LARGE_MBSTATE_T)
-typedef int _Mbstatet;
-#endif
-
#define _ATEXIT_T void
#define _Mbstinit(x) mbstate_t x = {0}
_C_STD_END
--
2.55.0.windows.4
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public