I apologize; I forgot about this issue shortly after mentioning it. I reported[1] it to bug-autoconf yesterday.
As I was afraid, it would be troublesome to fix on autoconf's side. There are two ways we can deal with it: First, simply `#undef pid_t`. We define it to the same base types as autoconf's AC_TYPE_PID_T, so this should be fine. To make sure things are consistent, we could add a size check for `pid_t` (we could add a macro like WINPTHREAD_STATIC_ASSERT for this). Second, guard our typedefs with #ifndef pid_t. I'm in favor of the first solution, I think types should be typedef'd rather than #define'd. What do you think? - Kirill Makurin [1] https://lists.gnu.org/archive/html/bug-autoconf/2025-12/msg00004.html ________________________________ From: Kirill Makurin <[email protected]> Sent: Monday, June 16, 2025 12:21 PM To: [email protected] <[email protected]> Cc: mingw-w64-public <[email protected]> Subject: [Mingw-w64-public] winpthreads: declaration of pid_t and autoconf's AC_TYPE_PID_T I think it is worth to report this issue to autoconf-bug mailing list first. I'll do it. If they will not want to fix this, we can simply ``` #ifdef pid_t #undef pid_t #endif ``` since we typedef it to the same base type as AC_TYPE_PID_T #define's it. - Kirill Makurin ________________________________ From: LIU Hao Sent: Wednesday, June 11, 2025 11:58 PM To: [email protected]; Kirill Makurin Subject: Re: [Mingw-w64-public] winpthreads: do not expose IN_WINPTHREAD in public header files 在 2025-6-6 17:41, Kirill Makurin 写道: > From 8c131c07c784799b56a889b0c25396e0c0ddb9e8 Mon Sep 17 00:00:00 2001 > From: Kirill Makurin <[email protected]> > Date: Fri, 6 Jun 2025 18:26:24 +0900 > Subject: [PATCH] winpthreads: do not expose IN_WINPTHREAD in public header > files > > When building winpthreads, define WINPTHREAD_API in config.h > instead of public pthread_compat.h. > > Definition of WINPTHREAD_API in pthread_compat.h will only be used > by client code. > > Note that IN_WINPTHREAD is still defined. > It is checked for in mingw-w64's time.h. > > Signed-off-by: Kirill Makurin <[email protected]> > --- > mingw-w64-libraries/winpthreads/configure.ac | 9 +++++++++ > .../winpthreads/include/pthread_compat.h | 18 ++++++------------ > 2 files changed, 15 insertions(+), 12 deletions(-) The patch looks good to me. I have pushed it to master now. I am actually in favor of this solution. I have another very similar setup with Meson, with this definition in pre-compiled header instead. > I have a question. What do you think about adding .pc (pkg-config) file for > winpthreads? If winpthreads is linked as `-pthread` (standard? no?) then there's no need to do that, because nobody would use pkgconf to look for 'winpthreads'. > There is also a problematic interaction between pthread_compat.h and > autoconf's AC_TYPE_PID_T. With MSVC, this check will fail and it will It is an unfortunate mistake. If VC defines `pid_t` then the VC definition should be preferred. -- Best regards, LIU Hao _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
