I added the ability to check if the thread model is POSIX to gcc a while back. 
This means our headers can now check for it and not include winpthreads 
specific headers if they are not required for the current thread model. This 
allows for gcc with other thread models to use certain standard library headers 
without needing to install winpthreads headers to avoid compilation errors.

best regards,
Julian

>From b5088da1feb549c9d0ebc3f05f704c284a3d2351 Mon Sep 17 00:00:00 2001
From: TheShermanTanker <tanksherma...@gmail.com>
Date: Thu, 10 Oct 2024 17:21:36 +0800
Subject: [PATCH] headers: Do not include pthread headers when the threading
 model is not POSIX

Signed-off-by: TheShermanTanker <tanksherma...@gmail.com>
---
 mingw-w64-headers/crt/signal.h | 2 ++
 mingw-w64-headers/crt/time.h   | 1 +
 2 files changed, 3 insertions(+)

diff --git a/mingw-w64-headers/crt/signal.h b/mingw-w64-headers/crt/signal.h
index ea59ecbb3..80f7afd66 100644
--- a/mingw-w64-headers/crt/signal.h
+++ b/mingw-w64-headers/crt/signal.h
@@ -7,7 +7,9 @@
 #define _INC_SIGNAL
 
 #include <crtdefs.h>
+#if defined(__clang__) || (defined(__GNUC__) && defined(__USING_POSIXTHREAD__))
 #include <pthread_signal.h>
+#endif
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/mingw-w64-headers/crt/time.h b/mingw-w64-headers/crt/time.h
index 2a475eeff..87ea6a974 100644
--- a/mingw-w64-headers/crt/time.h
+++ b/mingw-w64-headers/crt/time.h
@@ -318,6 +318,7 @@ __forceinline char *__CRTDECL asctime_r(const struct tm 
*_Tm, char * _Str) {
    but other systems - like Linux, Solaris, etc - tend to declare such
    recent extensions only if the following guards are met.  */
 #if !defined(IN_WINPTHREAD) && \
+       (defined(__clang__) || (defined(__GNUC__) && 
defined(__USING_POSIXTHREAD__))) && \
        ((!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
         (_POSIX_C_SOURCE > 2) || defined(__EXTENSIONS__))
 #include <pthread_time.h>
-- 
2.45.2



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to