winpthreads: Ensure `struct _timespec{32,64}` are defined before use
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.laine@m4x.org>
Signed-off-by: LIU Hao <lh_mouse@126.com>
2 files changed