Yes, the idea is to have the code CRT agnostic. If you think that this
does not bring any value then fell free to drop it.

I can try to apply test changes and check if test still passes.

On Monday 22 September 2025 21:47:57 Kirill Makurin wrote:
> I'm skeptical about this one. I think the only case where it would ever 
> matter is a static library. I guess it would allow us to build winpthreads as 
> a static library and reuse it with any CRT? Or is there any other reason?
> 
> Pali, you could apply this patch series[1] I sent last week and run `make 
> check` in winpthreads' build tree to test you changes if you want.
> 
> - Kirill Makurin
> 
> [1]https://sourceforge.net/p/mingw-w64/mailman/message/59233119/
> ________________________________
> From: Pali Rohár <[email protected]>
> Sent: Monday, September 22, 2025 6:16 PM
> To: [email protected] 
> <[email protected]>
> Cc: Martin Storsjö <[email protected]>; LIU Hao <[email protected]>; Kirill 
> Makurin <[email protected]>
> Subject: [PATCH 5/6] winpthreads: Define __LARGE_MBSTATE_T for thread.c
> 
> Since commit f9799b4ff03c ("winpthreads: use `mbsrtowcs` instead of
> `mbstowcs`"), winpthreads's thread.c uses mbstate_t structure which size
> in header file depends on used CRT library.
> 
> By defining __LARGE_MBSTATE_T, the thread.c which allocates mbstate_t on
> stack will be compatible with both msvcrt and UCRT builds. msvcrt would
> just ignore additional fields and UCRT will have accessible all of them.
> 
> Same thing is already used in mingw_pformat.c, mingw_sformat.c and
> mingw_swformat.c to make code compatible with all CRT libs.
> ---
>  mingw-w64-libraries/winpthreads/src/thread.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/mingw-w64-libraries/winpthreads/src/thread.c 
> b/mingw-w64-libraries/winpthreads/src/thread.c
> index b1d9cb92933f..220167922ec8 100644
> --- a/mingw-w64-libraries/winpthreads/src/thread.c
> +++ b/mingw-w64-libraries/winpthreads/src/thread.c
> @@ -20,6 +20,8 @@
>     DEALINGS IN THE SOFTWARE.
>  */
> 
> +#define __LARGE_MBSTATE_T
> +
>  #ifdef HAVE_CONFIG_H
>  #include "config.h"
>  #endif
> --
> 2.20.1
> 


_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to