[Mingw-w64-public] [PATCH] winpthreads: check if __GNUC__ is defined to prevent -Wundef warning

2025-04-17 Thread Antonin Décimo
--- mingw-w64-libraries/winpthreads/src/thread.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libraries/winpthreads/src/thread.c index d5b3aaa05..f1af0ea44 100644 --- a/mingw-w64-libraries/winpthreads/src

Re: [Mingw-w64-public] Building winpthreads with MSVC tools

2024-11-07 Thread Antonin Décimo
Hi! Patch 1 is obviously correct. Patch 2 seems correct too. I wrote a patch series a while ago that changed the winpthreads testsuite for msvc but didn't get the time to get it merged. See the full thread here: https://sourceforge.net/p/mingw-w64/mailman/mingw-w64-public/thread/20240129165759.1912

[Mingw-w64-public] [PATCH v2] winpthreads: also use SetThreadDescription to set thread name

2024-10-21 Thread Antonin Décimo
y which they work are independent of > each other. Signed-off-by: Antonin Décimo --- Thanks for the review! I've amended the commit message above to be hopefully a bit clearer. mingw-w64-libraries/winpthreads/src/misc.c | 8 mingw-w64-libraries/winpthreads/src/misc.h

[Mingw-w64-public] [PATCH] winpthreads: also use SetThreadDescription to set thread name

2024-10-17 Thread Antonin Décimo
22&tabs=csharp#set-a-thread-name-in-cc Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.c | 8 mingw-w64-libraries/winpthreads/src/misc.h | 1 + mingw-w64-libraries/winpthreads/src/thread.c | 15 +++ 3 files changed, 24 insertions(+) diff

Re: [Mingw-w64-public] [PATCH] Use gitattributes to force LF line endings on shell scripts

2024-10-10 Thread Antonin Décimo
> Frankly speaking, I don't agree with that. Are you disagreeing about the default autocrlf setting, or about forcing LF on shell scripts? I don't have a strong opinion on the autocrlf setting. I do have a strong opinion on forcing LF on shell scripts. I think this helps when dealing with unconfig

Re: [Mingw-w64-public] [PATCH] Use gitattributes to force LF line endings on shell scripts

2024-10-09 Thread Antonin Décimo
> > +# Set the default behavior, in case people don't have core.autocrlf set. > > +* text=auto > > Would you prefer `autocrlf=input` to `autocrlf=auto`? Not necessarily, were there ever unwanted CRLF or LF being committed to the repository? What really matters to me are unwanted CRLF when checking

Re: [Mingw-w64-public] [PATCH] Fix constructor priority to make it run first

2024-10-08 Thread Antonin Décimo
My mingw-w64 12.0.4 reports a warning: -Wprio-ctor-dtor Do not warn if a priority from 0 to 100 is used for constructor or destructor. The use of constructor and destructor attributes allow you to assign a priority to the constructor/destructor to control its order of execution before main is cal

[Mingw-w64-public] [PATCH] Use gitattributes to force LF line endings on shell scripts

2024-10-08 Thread Antonin Décimo
Otherwise bash errors with errors such as ./configure: line 17: $'\r': command not found ./configure: line 33: syntax error near unexpected token `newline' '/configure: line 33: ` ;; Signed-off-by: Antonin Décimo --- .gitattributes

Re: [Mingw-w64-public] wspiapi.h:50:20: warning: cast between incompatible function types from ‘void (__attribute__((stdcall)) *)(struct addrinfo *)’ to ‘int (__attribute__((stdcall)) *)()’ [-Wcast-f

2024-08-05 Thread Antonin Décimo
Le lun. 5 août 2024 à 11:27, LIU Hao a écrit : > > 在 2024-08-05 01:40, Pali Rohár 写道: > > It looks like that casting whole function pointer to LPVOID type prior > > casting to FARPROC mutes this warning. > > > > Now I remember that in past I have already used casting return value > > from GetProcA

Re: [Mingw-w64-public] [PATCH] winpthreads: add a .gitignore

2024-04-25 Thread Antonin Décimo
> Do you wish to create a separate repository for winpthreads, and commit > .gitignore there? We're maintaining a separate repository at https://github.com/ocaml/winpthreads, with instructions on how to embed the subtree as a submodule in the ocaml sources at https://github.com/ocaml/ocaml/blob/t

[Mingw-w64-public] [PATCH] winpthreads: add a .gitignore

2024-04-24 Thread Antonin Décimo
This helps when vendoring winpthreads as a subtree. --- I've just copied the root .gitignore. Works as expected. mingw-w64-libraries/winpthreads/.gitignore | 41 ++ 1 file changed, 41 insertions(+) create mode 100644 mingw-w64-libraries/winpthreads/.gitignore diff --git a/m

Re: [Mingw-w64-public] [PATCH] winpthreads: Avoid using MemoryBarrier() in public headers with GCC/Clang

2024-04-23 Thread Antonin Décimo
> Liu Hao also pointed out that we could use _ReadWriteBarrier() with MSVC, > and that one doesn't seem to require including any header before it is > usable. I couldn't find the difference between MemoryBarrier and _ReadWriteBarrier. Maybe the MemoryBarrier macro is available on more architecture

Re: [Mingw-w64-public] [PATCH v4 6/9] winpthreads: Unify discovery of recent WinAPI functions

2024-02-09 Thread Antonin Décimo
> If my suggested modification is ok with you, I'd go ahead and push this set soon. Thank you very much for your careful review, your patch makes it clearly better! -- Antonin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net htt

[Mingw-w64-public] [PATCH 6/9] winpthreads: tests: Use QPC instead of getntptimeofday

2024-01-29 Thread Antonin Décimo
getntptimeofday is specific to mingw. QueryPerformanceCounter is always available. https://learn.microsoft.com/en-us/windows/win32/sysinfo/acquiring-high-resolution-time-stamps\#using-qpc-in-native-code Signed-off-by: Antonin Décimo --- .../winpthreads/tests/t_nanosleep.c | 29

[Mingw-w64-public] [PATCH 4/9] winpthreads: tests: Remove unused variables

2024-01-29 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/tests/t_clock_getres.c| 2 +- mingw-w64-libraries/winpthreads/tests/t_clock_gettime.c | 3 ++- mingw-w64-libraries/winpthreads/tests/t_clock_nanosleep.c | 2 +- mingw-w64-libraries/winpthreads/tests/t_clock_settime.c | 4

[Mingw-w64-public] [PATCH 8/9] winpthreads: tests: Allow running tests with MSVC or clang-cl

2024-01-29 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/tests/Makefile.am | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/tests/Makefile.am b/mingw-w64-libraries/winpthreads/tests/Makefile.am index 19ab5f23e..d0b3ed9fa

[Mingw-w64-public] [PATCH 5/9] winpthreads: tests: Include missing pthread_time.h header

2024-01-29 Thread Antonin Décimo
Missing clock_nanosleep and nanosleep declarations. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/tests/t_clock_gettime.c | 1 + mingw-w64-libraries/winpthreads/tests/t_nanosleep.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/mingw-w64-libraries

[Mingw-w64-public] [PATCH 7/9] winpthreads: tests: Fix minor issues

2024-01-29 Thread Antonin Décimo
- conversion warnings from the compiler; - random generator not initialized. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/tests/t_clock_getres.c | 2 +- mingw-w64-libraries/winpthreads/tests/t_nanosleep.c| 9 ++--- 2 files changed, 7 insertions(+), 4 deletions

[Mingw-w64-public] [PATCH 1/9] winpthreads: tests: Use the libc assert

2024-01-29 Thread Antonin Décimo
It doesn't trigger a popup in console/batch mode. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/tests/t_clock_getres.c | 9 + mingw-w64-libraries/winpthreads/tests/t_clock_gettime.c | 9 + .../winpthreads/tests/t_clock_nanosleep.c

[Mingw-w64-public] [PATCH 3/9] winpthreads: tests: Don't use old-style function definition

2024-01-29 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- .../winpthreads/tests/t_clock_gettime.c | 2 +- .../winpthreads/tests/t_clock_nanosleep.c| 2 +- .../winpthreads/tests/t_clock_settime.c | 2 +- .../winpthreads/tests/t_nanosleep.c | 2 +- mingw-w64-libraries

[Mingw-w64-public] [PATCH 2/9] winpthreads: tests: Mark unexported symbols as static

2024-01-29 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- .../winpthreads/tests/t_clock_getres.c| 4 +- .../winpthreads/tests/t_clock_gettime.c | 2 +- .../winpthreads/tests/t_clock_nanosleep.c | 2 +- .../winpthreads/tests/t_clock_settime.c | 2 +- .../winpthreads/tests/t_nanosleep.c

[Mingw-w64-public] [PATCH 9/9] winpthreads: tests: Regenerate Makefile.in

2024-01-29 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/tests/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mingw-w64-libraries/winpthreads/tests/Makefile.in b/mingw-w64-libraries/winpthreads/tests/Makefile.in index bb0e75bcc..1cf0f5efe 100644 --- a

[Mingw-w64-public] [PATCH 0/9] winpthreads: Improve and port tests to MSVC

2024-01-29 Thread Antonin Décimo
-w64-mingw32 make -j make check -j1 The patch series only touches tests registered via Automake, and *not* the tests imported from pthread-win32. Best regards, Antonin Décimo (9): winpthreads: tests: Use the libc assert winpthreads: tests: Mark unexported symbols as static

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

2024-01-26 Thread Antonin Décimo
/win32/api/winnt/nf-winnt-memorybarrier [3]: https://learn.microsoft.com/en-us/cpp/intrinsics/readwritebarrier\?view\=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/include/pthread.h | 4 ++-- mingw-w64-libraries/winpthreads/src/misc.h| 4 2 files changed, 2

[Mingw-w64-public] [PATCH v4 9/9] winpthreads: Move __declspec specifiers before types

2024-01-26 Thread Antonin Décimo
selectany & int both part of decl-specifier int __declspec(selectany) * pi2 = 0; // ERROR, selectany is not part of a declarator int * __declspec(selectany) pi3 = 0; https://learn.microsoft.com/en-us/cpp/cpp/declspec?view=msvc-170 Signed-off-by: Antonin Décimo --- .../winpth

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

2024-01-26 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

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

2024-01-26 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

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

2024-01-26 Thread Antonin Décimo
e needed to instruct the linker on MSVC, gather the discovery of the WinAPI functions in a single winpthreads_init function. The WinAPI functions can be accessed through internal global function pointers. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/clock.c | 31 ++---

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

2024-01-26 Thread Antonin Décimo
.com/en-us/windows/win32/sync/interlocked-variable-access Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/mutex.c| 15 +++ mingw-w64-libraries/winpthreads/src/spinlock.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mingw-w64

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

2024-01-26 Thread Antonin Décimo
eses functions at runtime with GetModuleHandle and GetProcAddress. It uses a function tagged with the constructor attribute for MinGW and clang-cl, and a CRT initialization and linker trick to use a single 'winpthreads_init' function to load these required WinAPI functions. Antonin Décimo (9): wi

[Mingw-w64-public] [PATCH v4 2/9] winpthreads: Fix pthread_create_wrapper type

2024-01-26 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

[Mingw-w64-public] [PATCH v4 3/9] winpthreads: Use YieldProcessor in pthread_spin_lock

2024-01-26 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 v4 1/9] winpthreads: Check if requested stack size fits in an unsigned int

2024-01-26 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

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

2024-01-19 Thread Antonin Décimo
> diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h > b/mingw-w64-libraries/winpthreads/include/pthread.h > index 0ab7fef11..4ce815c64 100644 > --- a/mingw-w64-libraries/winpthreads/include/pthread.h > +++ b/mingw-w64-libraries/winpthreads/include/pthread.h > @@ -307,7 +307,7 @@ unsig

[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

[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

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

2024-01-17 Thread Antonin Décimo
rick to use a single 'winpthreads_init' function to load these required WinAPI functions. Antonin Décimo (8): winpthreads: Check if requested stack size fits in an unsigned int winpthreads: Fix pthread_create_wrapper type winpthreads: Use YieldProcessor in pthread_spin_lock win

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

2024-01-17 Thread Antonin Décimo
.com/en-us/windows/win32/sync/interlocked-variable-access Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/mutex.c| 15 +++ mingw-w64-libraries/winpthreads/src/spinlock.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mingw-w64

[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

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

2024-01-17 Thread Antonin Décimo
/win32/api/winnt/nf-winnt-memorybarrier [3]: https://learn.microsoft.com/en-us/cpp/intrinsics/readwritebarrier\?view\=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/include/pthread.h | 4 ++-- mingw-w64-libraries/winpthreads/src/misc.h| 4 2 files changed, 2

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

2024-01-17 Thread Antonin Décimo
e needed to instruct the linker on MSVC, gather the discovery of the WinAPI functions in a single winpthreads_init function. The WinAPI functions can be accessed through internal global function pointers. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/clock.c | 31 ++---

[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

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

2024-01-16 Thread Antonin Décimo
Le lun. 15 janv. 2024 à 22:57, Martin Storsjö a écrit : > > On Thu, 11 Jan 2024, Antonin Décimo wrote: > > > Some WinAPI functions were introduced in recent versions of > > Windows. It's not possible to detect if they're available at compile > > time, so

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

2024-01-16 Thread Antonin Décimo
Le lun. 15 janv. 2024 à 22:57, Martin Storsjö a écrit : > > On Thu, 11 Jan 2024, Antonin Décimo wrote: > > > It is sufficient to specify the section on the symbol declaration. > > > > Signed-off-by: Antonin Décimo > > --- > > mingw-w64-libraries/winpth

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

2024-01-16 Thread Antonin Décimo
Le lun. 15 janv. 2024 à 23:01, Martin Storsjö a écrit : > > On Fri, 12 Jan 2024, LIU Hao wrote: > > > 在 2024/1/11 23:41, Antonin Décimo 写道: > >> The non-suffixed macro GetModuleHandle depends on whether the file is > >> being compiled in Unicode mode or

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

2024-01-11 Thread Antonin Décimo
/win32/api/winnt/nf-winnt-memorybarrier [3]: https://learn.microsoft.com/en-us/cpp/intrinsics/readwritebarrier\?view\=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/include/pthread.h | 4 ++-- mingw-w64-libraries/winpthreads/src/misc.h| 4 2 files changed, 2

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

2024-01-11 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 in this simple case. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.c | 2 +- mingw-w64-libraries/winpthreads/src

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

2024-01-11 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

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

2024-01-11 Thread Antonin Décimo
of boilerplate code needed to instruct the linker on MSVC, gather the discovery of the WinAPI functions in a single winpthreads_init function. The WinAPI functions can be accessed through internal global function pointers. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/c

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

2024-01-11 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

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

2024-01-11 Thread Antonin Décimo
.com/en-us/windows/win32/sync/interlocked-variable-access Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/mutex.c| 15 +++ mingw-w64-libraries/winpthreads/src/spinlock.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mingw-w64

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

2024-01-11 Thread Antonin Décimo
and linker trick to use a single 'winpthreads_init' function to load these required WinAPI functions. Antonin Décimo (8): winpthreads: Check if requested stack size fits in an unsigned int winpthreads: Fix pthread_create_wrapper type winpthreads: Use YieldProcessor in pthread

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

2024-01-11 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

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

2024-01-11 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] Consider regenerating autoconf scripts with autoconf 2.72

2024-01-08 Thread Antonin Décimo
Not so long after we updated to autoconf 2.71, a new release sporting bug fixes was cut. https://lists.gnu.org/archive/html/info-gnu/2023-12/msg2.html Using MSYS2 MINGW64 environment, and with an updated install, the scripts can be regenerated from the top directory with WANT_AUTOMAKE=1.16

Re: [Mingw-w64-public] [PATCH 4/6] winpthreads: Use GetTickCount64 directly if available

2024-01-08 Thread Antonin Décimo
> > https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount64 > > > > Signed-off-by: Antonin Décimo > > --- > > mingw-w64-libraries/winpthreads/src/misc.c | 29 +++--- > > 1 file changed, 20 insertions(+), 9 del

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

2023-12-28 Thread Antonin Décimo
/win32/api/winnt/nf-winnt-memorybarrier [3]: https://learn.microsoft.com/en-us/cpp/intrinsics/readwritebarrier\?view\=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/include/pthread.h | 4 ++-- mingw-w64-libraries/winpthreads/src/misc.h| 4 2 files changed, 2

[Mingw-w64-public] [PATCH 4/6] winpthreads: Use GetTickCount64 directly if available

2023-12-28 Thread Antonin Décimo
infoapi/nf-sysinfoapi-gettickcount64 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.c | 29 +++--- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/misc.c b/mingw-w64-libraries/winpthreads/src/misc.c index

[Mingw-w64-public] [PATCH 5/6] winpthreads: Replace GCC's __sync comparisons with WinAPI functions

2023-12-28 Thread Antonin Décimo
.com/en-us/windows/win32/sync/interlocked-variable-access Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/mutex.c| 15 +++ mingw-w64-libraries/winpthreads/src/spinlock.c | 4 ++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/mingw-w64

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

2023-12-28 Thread Antonin Décimo
rsion-17-5-preview-2/ Antonin Décimo (6): winpthreads: Check if requested stack size fits in an unsigned int winpthreads: Fix pthread_create_wrapper type winpthreads: Use YieldProcessor in pthread_spin_lock winpthreads: Use GetTickCount64 directly if available winpthreads: Replace GC

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

2023-12-28 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 2/6] winpthreads: Fix pthread_create_wrapper type

2023-12-28 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

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

2023-12-28 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

Re: [Mingw-w64-public] [PATCH v3 02/22] winpthreads: Move likely/unlikely to misc.h, noop under MSVC

2023-12-20 Thread Antonin Décimo
> I pushed this patchset now, with this change squashed in. Thanks a lot! Sorry for that mistake, I extracted the patchset from a larger branch, and that fix happened on a later commit. On to more hacking! -- Antonin ___ Mingw-w64-public mailing list M

[Mingw-w64-public] [PATCH v3 16/22] winpthreads: Separate MSVC and MinGW specific flags and targets

2023-12-14 Thread Antonin Décimo
- don't pass -D__USE_MINGW_ANSI_STDIO=0 to MSVC; - don't build libgcc/fakelib with MSVC. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/Makefile.am | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/Make

[Mingw-w64-public] [PATCH v3 21/22] winpthreads: Test explicitly the result of an assign in a condition

2023-12-14 Thread Antonin Décimo
mpiler-warnings/compiler-warning-level-4-c4706?view=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/barrier.c | 6 +++--- mingw-w64-libraries/winpthreads/src/cond.c| 6 +++--- mingw-w64-libraries/winpthreads/src/sem.c | 2 +- 3 files changed, 7 insertions

[Mingw-w64-public] [PATCH v3 18/22] winpthreads: Regenerate autotools scripts with automake 1.16.5

2023-12-14 Thread Antonin Décimo
This is done by running `WANT_AUTOMAKE=1.16 autoreconf -ifv` in the winpthreads directory. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/Makefile.in | 37 +++--- mingw-w64-libraries/winpthreads/configure | 131 2 files changed, 48 insertions(+), 120

[Mingw-w64-public] [PATCH v3 20/22] winpthreads: Fix __WINPTHREAD_ENABLE_WRAP_API typo

2023-12-14 Thread Antonin Décimo
Retain the old name for backwards compatibility. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/include/pthread.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include

[Mingw-w64-public] [PATCH v3 19/22] winpthreads: Update version.rc and support RC

2023-12-14 Thread Antonin Décimo
e field is updated to "MIT AND BSD-3-Clause" using SPDX [2] identifiers and expressions, removing ZPL, considering the COPYING file in winpthreads. [1]: https://learn.microsoft.com/en-us/windows/win32/menurc/resource-compiler [2]: https://spdx.dev/use/specifications/ Signed-of

[Mingw-w64-public] [PATCH v3 22/22] winpthreads: Fix strict prototypes warnings

2023-12-14 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/clock.c b/mingw-w64-libraries/winpthreads/src/clock.c index 322b7e5c4..db8b34ea5 100644 --- a/mingw-w64

[Mingw-w64-public] [PATCH v3 12/22] winpthreads: Small cleanups for clang

2023-12-14 Thread Antonin Décimo
- remove superflous semicolons; - avoid dead code warnings; - avoid function redeclaration with an added 'dllexport' attribute. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/sem.c| 4 ++-- mingw-w64-libraries/winpthreads/src/thread.c | 5 +++-- mingw-w64

[Mingw-w64-public] [PATCH v3 15/22] winpthreads: Silence MSVC copyright message

2023-12-14 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/Makefile.am | 4 mingw-w64-libraries/winpthreads/configure.ac | 5 - 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/mingw-w64-libraries/winpthreads/Makefile.am b/mingw-w64-libraries/winpthreads

[Mingw-w64-public] [PATCH v3 13/22] winpthreads: AC_PROG_RANLIB is obsoleted by LT_INIT

2023-12-14 Thread Antonin Décimo
Fixes a warning from libtoolize: 'AC_PROG_RANLIB' is rendered obsolete by 'LT_INIT'. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/configure.ac | 1 - 1 file changed, 1 deletion(-) diff --git a/mingw-w64-libraries/winpthreads/configure.ac b/mingw-w64-l

[Mingw-w64-public] [PATCH v3 07/22] winpthreads: Fix thread-local storage callbacks on MSVC

2023-12-14 Thread Antonin Décimo
https://learn.microsoft.com/en-us/cpp/preprocessor/pragma-seg?view=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/thread.c | 33 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw-w64-libr

[Mingw-w64-public] [PATCH v3 04/22] winpthreads: Inline INIT_RWLOCK into its only callsite

2023-12-14 Thread Antonin Décimo
Prevents a warning of `r` being shadowed, and makes the code clearer. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/rwlock.c | 6 +- mingw-w64-libraries/winpthreads/src/rwlock.h | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/mingw-w64

[Mingw-w64-public] [PATCH v3 03/22] winpthreads: Use __assume(0) MSVC builtin for unreachable code

2023-12-14 Thread Antonin Décimo
https://learn.microsoft.com/en-us/cpp/intrinsics/assume?view=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.h | 6 ++ mingw-w64-libraries/winpthreads/src/mutex.c | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/mingw-w64-libraries

[Mingw-w64-public] [PATCH v3 14/22] winpthreads: Add windres-rc, a wrapper for windres to rc

2023-12-14 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- .../winpthreads/build-aux/windres-rc | 158 ++ mingw-w64-libraries/winpthreads/configure.ac | 7 +- 2 files changed, 163 insertions(+), 2 deletions(-) create mode 100755 mingw-w64-libraries/winpthreads/build-aux/windres-rc diff

[Mingw-w64-public] [PATCH v3 11/22] winpthreads: Fix include style

2023-12-14 Thread Antonin Décimo
windows.h is a system header and better placed at first, enclosed in angle brackets. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/barrier.h | 2 +- mingw-w64-libraries/winpthreads/src/misc.c| 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a

[Mingw-w64-public] [PATCH v3 17/22] winpthreads: Disable warnings for POSIX function names

2023-12-14 Thread Antonin Décimo
-messages/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-170#posix-function-names Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/Makefile.am | 1 + 1 file changed, 1 insertion(+) diff --git a/mingw-w64-libraries/winpthreads/Makefile.am b/mingw-w64-libraries/winpthreads

[Mingw-w64-public] [PATCH v3 09/22] winpthreads: Protect macros with do { ... } while (0) idiom

2023-12-14 Thread Antonin Décimo
-the-Semicolon.html Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/barrier.h | 7 +++-- mingw-w64-libraries/winpthreads/src/cond.h| 10 --- mingw-w64-libraries/winpthreads/src/misc.h| 30 --- 3 files changed, 30 insertions(+), 17 deletions

[Mingw-w64-public] [PATCH v3 10/22] winpthreads: Prevent scoping issues and warnings in cleanup_push/pop

2023-12-14 Thread Antonin Décimo
in pthread_cleanup_pop prevents compiler warnings against not using the return value of the expression, and a against an empty statement. [1]: https://gcc.gnu.org/onlinedocs/cpp/Swallowing-the-Semicolon.html Signed-off-by: Antonin Décimo --- .../winpthreads/include/pthread.h | 22

[Mingw-w64-public] [PATCH v3 08/22] winpthreads: Fix printf format specifiers

2023-12-14 Thread Antonin Décimo
As DWORD is a typedef for unsigned long, we can use the %lu format specifier. The %p format specifier requires (void *) pointers. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/cond.c | 6 +++--- mingw-w64-libraries/winpthreads/src/rwlock.c | 6 +++--- mingw-w64

[Mingw-w64-public] [PATCH v3 00/22] winpthreads: Patches and cleanups towards MSVC support

2023-12-14 Thread Antonin Décimo
cts the COPYING file of winpthreads. Thanks to Martin Storsjö for the previous rounds of insightful reviews. I have more patches incoming but I would prefer to get this batch in first. Thanks a lot for the hard work! Antonin Décimo (22): winpthreads: Ignore MSVC object files and Autotools

[Mingw-w64-public] [PATCH v3 02/22] winpthreads: Move likely/unlikely to misc.h, noop under MSVC

2023-12-14 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/misc.h | 8 mingw-w64-libraries/winpthreads/src/mutex.c| 3 --- mingw-w64-libraries/winpthreads/src/spinlock.c | 3 --- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/mingw-w64-libraries

[Mingw-w64-public] [PATCH v3 05/22] winpthreads: Format error string with snprintf

2023-12-14 Thread Antonin Décimo
Previous code was too complex and hard to understand, and snprintf fits the job nicely. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/thread.c | 21 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src

[Mingw-w64-public] [PATCH v3 01/22] winpthreads: Ignore MSVC object files and Autotools generated files

2023-12-14 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- .gitignore | 4 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index 4cd47565a..3d1022348 100644 --- a/.gitignore +++ b/.gitignore @@ -12,13 +12,17 @@ *.lo *.la *.gch +*.obj +*.res # Specialized files autom4te.cache

[Mingw-w64-public] [PATCH v3 06/22] winpthreads: PIMAGE_TLS_CALLBACK returns void, not BOOL

2023-12-14 Thread Antonin Décimo
https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#tls-callback-functions Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/thread.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw

Re: [Mingw-w64-public] [PATCH v2 15/20] winpthreads: Update version.rc and support RC

2023-12-07 Thread Antonin Décimo
> After checking, winpthreads itself is licensed under a mix of MIT, BSD > 3-clauses, and Public Domain [3] (whatever that means). > It's really not clear… Most of the files have MIT headers, some Public > Domain, BSD 3-clauses could be here for historical reasons, maybe > there are actually no par

Re: [Mingw-w64-public] [PATCH v2 07/20] winpthreads: Fix thread-local storage callbacks on MSVC

2023-12-05 Thread Antonin Décimo
Unfortunately I somehow forgot to test this new patch with clang-cl, which warns about the snippet. It requires a previous declaration of the variable. I'm not sure if both declaration and definition require the attributes too. src/thread.c(540,84): error: no previous extern declaration for non-st

Re: [Mingw-w64-public] [PATCH v2 15/20] winpthreads: Update version.rc and support RC

2023-12-05 Thread Antonin Décimo
> These changes here aren't accounted for in the commit message; the typo > fixes are straightforward, but it might be good also to mention that > you're expressing the license with a specific version That's probably me being overzealous! My intent was to use the ZPL SPDX identifier [1]. There's n

Re: [Mingw-w64-public] [PATCH v2 07/20] winpthreads: Fix thread-local storage callbacks on MSVC

2023-12-05 Thread Antonin Décimo
> Very much a nitpick/subjective preference; there's no need to use shouty > uppercase for the /INCLUDE directive, lowercase should work just as well. And shouting at the linker doesn't fix its bugs :/ > Other than that, this patch looks good to me now, thanks! Thanks a lot for the reviews! --

[Mingw-w64-public] [PATCH v2 16/20] winpthreads: Disable warnings for POSIX function names

2023-12-04 Thread Antonin Décimo
/compiler-warnings/compiler-warning-level-3-c4996?view=msvc-170#posix-function-names Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-libraries/winpthreads/configure.ac b/mingw-w64-libraries

[Mingw-w64-public] [PATCH v2 18/20] winpthreads: Fix __WINPTHREAD_ENABLE_WRAP_API typo

2023-12-04 Thread Antonin Décimo
Retain the old name for backwards compatibility. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/include/pthread.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mingw-w64-libraries/winpthreads/include/pthread.h b/mingw-w64-libraries/winpthreads/include

[Mingw-w64-public] [PATCH v2 06/20] winpthreads: PIMAGE_TLS_CALLBACK returns void, not BOOL

2023-12-04 Thread Antonin Décimo
https://learn.microsoft.com/en-us/windows/win32/debug/pe-format#tls-callback-functions Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/thread.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/thread.c b/mingw

[Mingw-w64-public] [PATCH v2 20/20] winpthreads: Fix strict prototypes warnings

2023-12-04 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/clock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/src/clock.c b/mingw-w64-libraries/winpthreads/src/clock.c index 322b7e5c4..db8b34ea5 100644 --- a/mingw-w64

[Mingw-w64-public] [PATCH v2 17/20] winpthreads: Regenerate configure

2023-12-04 Thread Antonin Décimo
Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/configure | 117 ++ 1 file changed, 11 insertions(+), 106 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/configure b/mingw-w64-libraries/winpthreads/configure index 22b955cd4..da002e7cb 100755

[Mingw-w64-public] [PATCH v2 08/20] winpthreads: Fix printf format specifiers

2023-12-04 Thread Antonin Décimo
As DWORD is a typedef for unsigned long, we can use the %lu format specifier. The %p format specifier requires (void *) pointers. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/cond.c | 6 +++--- mingw-w64-libraries/winpthreads/src/rwlock.c | 6 +++--- mingw-w64

[Mingw-w64-public] [PATCH v2 19/20] winpthreads: Don't assign within a conditional expression

2023-12-04 Thread Antonin Décimo
This particular snippet raises an annoying MSVC warning, C4706. https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4706?view=msvc-170 Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/barrier.c | 6 +++--- mingw-w64-libraries

[Mingw-w64-public] [PATCH v2 12/20] winpthreads: Small cleanups for clang

2023-12-04 Thread Antonin Décimo
- remove superflous semicolons; - avoid dead code warnings; - avoid function redeclaration with an added 'dllexport' attribute. Signed-off-by: Antonin Décimo --- mingw-w64-libraries/winpthreads/src/sem.c| 4 ++-- mingw-w64-libraries/winpthreads/src/thread.c | 5 +++-- mingw-w64

  1   2   >