On Fri, 16 May 2025, LIU Hao wrote:

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é <jeremy.la...@m4x.org>
Signed-off-by: LIU Hao <lh_mo...@126.com>
---
mingw-w64-libraries/winpthreads/include/pthread_time.h | 1 +
mingw-w64-libraries/winpthreads/include/semaphore.h    | 1 +
2 files changed, 2 insertions(+)

LGTM

// Martin

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

Reply via email to