We have declarations such as WINPTHREAD_API int sem_timedwait64(sem_t * sem, const struct _timespec64 *t);
When `struct _timespec64` is not forward-declared, this function declaration declares a new struct whose scope is limited to that function. In this case it is not the same type as the one in file scope, which causes errors like C:/MSYS64/mingw64/include/semaphore.h: In function 'sem_timedwait':C:/MSYS64/mingw64/include/semaphore.h:53:32: error: passing argument 2 of 'sem_timedwait64' from incompatible pointer type [-Wincompatible-pointer-types]
53 | return sem_timedwait64 (sem, (const struct _timespec64 *) t);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| const struct _timespec64 *
C:/MSYS64/mingw64/include/semaphore.h:47:75: note: expected 'const struct _timespec64 *' but argument
is of type 'const struct _timespec64 *'
47 | WINPTHREAD_API int sem_timedwait64(sem_t * sem, const struct
_timespec64 *t);
|
~~~~~~~~~~~~~~~~~~~~~~~~~~^
We include <sys/timeb.h> so those function declarations reference the global
types and do not declare their own.
Reported-by: Jeremy Lainé <[email protected]>
Signed-off-by: LIU Hao <[email protected]>
---
mingw-w64-libraries/winpthreads/include/pthread_time.h | 1 +
mingw-w64-libraries/winpthreads/include/semaphore.h | 1 +
2 files changed, 2 insertions(+)
diff --git a/mingw-w64-libraries/winpthreads/include/pthread_time.h
b/mingw-w64-libraries/winpthreads/include/pthread_time.h
index ac014aefc..27f7566f0 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread_time.h +++ b/mingw-w64-libraries/winpthreads/include/pthread_time.h @@ -23,6 +23,7 @@ #ifndef WIN_PTHREADS_TIME_H #define WIN_PTHREADS_TIME_H +#include <sys/timeb.h> #include "pthread_compat.h" /* Posix timers are supported */diff --git a/mingw-w64-libraries/winpthreads/include/semaphore.h b/mingw-w64-libraries/winpthreads/include/semaphore.h
index 649583ffc..9a6c211a9 100644 --- a/mingw-w64-libraries/winpthreads/include/semaphore.h +++ b/mingw-w64-libraries/winpthreads/include/semaphore.h @@ -23,6 +23,7 @@ #ifndef WIN_PTHREADS_SEMAPHORE_H #define WIN_PTHREADS_SEMAPHORE_H +#include <sys/timeb.h> #include "pthread_compat.h" #ifdef __cplusplus -- 2.49.0
From 654de71b13f67557e57376361e2c950aedda66f4 Mon Sep 17 00:00:00 2001 From: LIU Hao <[email protected]> Date: Fri, 16 May 2025 14:50:32 +0800 Subject: [PATCH] winpthreads: Ensure `struct _timespec{32,64}` are defined before use MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have declarations such as WINPTHREAD_API int sem_timedwait64(sem_t * sem, const struct _timespec64 *t); When `struct _timespec64` is not forward-declared, this function declaration declares a new struct whose scope is limited to that function. In this case it is not the same type as the one in file scope, which causes errors like C:/MSYS64/mingw64/include/semaphore.h: In function 'sem_timedwait': C:/MSYS64/mingw64/include/semaphore.h:53:32: error: passing argument 2 of 'sem_timedwait64' from incompatible pointer type [-Wincompatible-pointer-types] 53 | return sem_timedwait64 (sem, (const struct _timespec64 *) t); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | const struct _timespec64 * C:/MSYS64/mingw64/include/semaphore.h:47:75: note: expected 'const struct _timespec64 *' but argument is of type 'const struct _timespec64 *' 47 | WINPTHREAD_API int sem_timedwait64(sem_t * sem, const struct _timespec64 *t); | ~~~~~~~~~~~~~~~~~~~~~~~~~~^ We include <sys/timeb.h> so those function declarations reference the global types and do not declare their own. Reported-by: Jeremy Lainé <[email protected]> Signed-off-by: LIU Hao <[email protected]> --- mingw-w64-libraries/winpthreads/include/pthread_time.h | 1 + mingw-w64-libraries/winpthreads/include/semaphore.h | 1 + 2 files changed, 2 insertions(+) diff --git a/mingw-w64-libraries/winpthreads/include/pthread_time.h b/mingw-w64-libraries/winpthreads/include/pthread_time.h index ac014aefc..27f7566f0 100644 --- a/mingw-w64-libraries/winpthreads/include/pthread_time.h +++ b/mingw-w64-libraries/winpthreads/include/pthread_time.h @@ -23,6 +23,7 @@ #ifndef WIN_PTHREADS_TIME_H #define WIN_PTHREADS_TIME_H +#include <sys/timeb.h> #include "pthread_compat.h" /* Posix timers are supported */ diff --git a/mingw-w64-libraries/winpthreads/include/semaphore.h b/mingw-w64-libraries/winpthreads/include/semaphore.h index 649583ffc..9a6c211a9 100644 --- a/mingw-w64-libraries/winpthreads/include/semaphore.h +++ b/mingw-w64-libraries/winpthreads/include/semaphore.h @@ -23,6 +23,7 @@ #ifndef WIN_PTHREADS_SEMAPHORE_H #define WIN_PTHREADS_SEMAPHORE_H +#include <sys/timeb.h> #include "pthread_compat.h" #ifdef __cplusplus -- 2.49.0
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
