Re: [Mingw-w64-public] [PATCH] headers: do not include fltwinerror.h in winerror.h

2024-01-17 Thread Biswapriyo Nath
Could you explain what the issue was and how this patch resolves it? ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

[Mingw-w64-public] [PATCH] headers: do not include fltwinerror.h in winerror.h

2024-01-17 Thread Oleg Tolmatcev
Hello, while experimenting with TinyCC I ran into some problems with fltwinerror.h. Best regards Oleg Tolmatcev From b8a4fcb417c7ee8063d74d0e4b29a50d5484278f Mon Sep 17 00:00:00 2001 From: Oleg Tolmatcev Date: Fri, 29 Dec 2023 14:15:46 +0100 Subject: [PATCH] headers: do not include fltwinerror.h

[Mingw-w64-public] [PATCH v3 1/8] winpthreads: Check if requested stack size fits in an unsigned int

2024-01-17 Thread Antonin Décimo
The requested stack size is a `size_t`, whereas _beginthreadex takes an `unsigned int`. This provides a bit of input sanitation, and prevents a compiler warning. Co-authored-by: Samuel Hym Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/thread.c | 7 +-- 1 file changed

[Mingw-w64-public] [PATCH v3 3/8] winpthreads: Use YieldProcessor in pthread_spin_lock

2024-01-17 Thread Antonin Décimo
Use YieldProcessor which already has the best definition for all MSVC and MinGW supported architectures of the memory pause / yield instruction. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.h | 8 mingw-w64-libraries/winpthreads/src/spinlock.c | 8 +

[Mingw-w64-public] [PATCH v3 2/8] winpthreads: Fix pthread_create_wrapper type

2024-01-17 Thread Antonin Décimo
- Make pthread_create_wrapper return an unsigned; _beginthreadindex takes a function returning an unsigned. The variable holding the return value of pthread_create_wrapper is already an unsigned. - Make pthread_create_wrapper __stdcall. Co-authored-by: Samuel Hym Signed-off-by: Antonin Dé

[Mingw-w64-public] [PATCH v3 0/8] winpthreads: MSVC support without GCC extensions

2024-01-17 Thread Antonin Décimo
This patch series enables building winpthreads with MSVC. The missing steps were about removing uses of GCC extensions, in favor of using functions already provided by windows.h. MinGW also provides these functions, so there should be no need for redefinitions in winpthreads. If there's interest,

[Mingw-w64-public] [PATCH v3 4/8] winpthreads: Replace GCC's __sync comparisons with WinAPI functions

2024-01-17 Thread Antonin Décimo
Legacy `__sync_*` GCC built-in functions for memory access [1] are deprecated and MSVC doesn't provide them. Consequently, use Windows' Interlocked Variable Access [2] functions instead. [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html [2]: https://learn.microsoft.com/en-us/wi

[Mingw-w64-public] [PATCH v3 7/8] winpthreads: Simplify placing a symbol in a section

2024-01-17 Thread Antonin Décimo
It is sufficient to specify the section on the symbol declaration. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/thread.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthrea

[Mingw-w64-public] [PATCH v3 5/8] winpthreads: Don't use GCC __sync_synchronize

2024-01-17 Thread Antonin Décimo
The __sync_synchronize built-in function [1] is deprecated, and not defined with MSVC. Prefer MemoryBarrier [2] and _ReadWriteBarrier [3]. [1]: https://gcc.gnu.org/onlinedocs/gcc/_005f_005fsync-Builtins.html#index-_005f_005fsync_005fsynchronize [2]: https://learn.microsoft.com/en-us/windows/win3

[Mingw-w64-public] [PATCH v3 6/8] winpthreads: Unify discovery of recent WinAPI functions

2024-01-17 Thread Antonin Décimo
Some WinAPI functions were introduced in recent versions of Windows. We could detect whether to use the newer functions based on the _WIN32_WINNT define. However, the issue is that _WIN32_WINNT defaults to Win10 these days, so a default build of a toolchain won't work for older targets, which is wh

[Mingw-w64-public] [PATCH v3 8/8] winpthreads: Use GetModuleHandleA to prevent Unicode errors

2024-01-17 Thread Antonin Décimo
The non-suffixed macro GetModuleHandle depends on whether the file is being compiled in Unicode mode or not. Prefer using the char string literal here, for compatibility with old Windows not supporting Unicode. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.c | 2 +-