This should fix error when compiling C++ modules[1]. - Kirill Makurin
[1] https://github.com/mingw-w64/mingw-w64/issues/99
From c3d9c047a80ee40545388a0359f25fa3d1f4a95e Mon Sep 17 00:00:00 2001 From: Kirill Makurin <maiddais...@outlook.com> Date: Sun, 22 Jun 2025 04:01:04 +0900 Subject: [PATCH] winpthreads: fix compiling C++ modules Reported in <https://github.com/mingw-w64/mingw-w64/issues/99>. Signed-off-by: Kirill Makurin <maiddais...@outlook.com> --- .../winpthreads/include/pthread_compat.h | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/mingw-w64-libraries/winpthreads/include/pthread_compat.h b/mingw-w64-libraries/winpthreads/include/pthread_compat.h index b682a3a17..2a978ffb4 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread_compat.h +++ b/mingw-w64-libraries/winpthreads/include/pthread_compat.h @@ -118,25 +118,59 @@ typedef int pid_t; #endif #ifndef WINPTHREAD_CLOCK_DECL -#define WINPTHREAD_CLOCK_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_CLOCK_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_CLOCK_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif + #ifndef WINPTHREAD_COND_DECL -#define WINPTHREAD_COND_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_COND_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_COND_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif + #ifndef WINPTHREAD_MUTEX_DECL -#define WINPTHREAD_MUTEX_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_MUTEX_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_MUTEX_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif + #ifndef WINPTHREAD_NANOSLEEP_DECL -#define WINPTHREAD_NANOSLEEP_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_NANOSLEEP_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_NANOSLEEP_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif + #ifndef WINPTHREAD_RWLOCK_DECL -#define WINPTHREAD_RWLOCK_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_RWLOCK_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_RWLOCK_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif + #ifndef WINPTHREAD_SEM_DECL -#define WINPTHREAD_SEM_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_SEM_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_SEM_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif + #ifndef WINPTHREAD_THREAD_DECL -#define WINPTHREAD_THREAD_DECL static WINPTHREADS_ALWAYS_INLINE +# ifdef __cplusplus +# define WINPTHREAD_THREAD_DECL WINPTHREADS_ALWAYS_INLINE +# else +# define WINPTHREAD_THREAD_DECL static WINPTHREADS_ALWAYS_INLINE +# endif #endif #endif -- 2.46.1.windows.1
_______________________________________________ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public