[Mesa-dev] [PATCH] threads: fix MinGW build breakage

Jon Turney jon.turney at dronecode.org.uk
Fri Nov 10 18:39:37 UTC 2017


On 10/11/2017 15:42, Nicolai Hähnle wrote:
> On 10.11.2017 14:00, Jon Turney wrote:
>> On 09/11/2017 21:41, Nicolai Hähnle wrote:
>>> Sorry for the mess.
>>
>> I'm going to suggest that the fallback declaration of timespec_get() 
>> also needs to be provided for POSIX systems which don't have it.
>>
>> Not noticed previously as it (or xtime_get()) doesn't seem to have had 
>> any users, prior to this series.
>>
>> Patch attached.
> 
> Do you have a system where this is actually needed? Currently 
> HAVE_TIMESPEC_GET is only defined in threads_win32.h, so some more 
> detection logic somewhere would be required if this actually turns out 
> to be an issue.

Hmm.. yes, I'd assumed that HAVE_TIMESPEC_GET was the result of an 
autoconf check, but it isn't.

Cygwin doesn't (currently) have timespec_get().

I'm thinking the correct solution here is actually to unconditionally 
declare timespec_get(), just like all the other C11 thread functions 
(and as the unused xtime_get() was, prior to 
f1a364878431c8c5f4fd38b40b9766449e49f552)?

Revised patch attached.
-------------- next part --------------
From f71d15ccab81af7dfb7393ed947827f02d333733 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney at dronecode.org.uk>
Date: Fri, 10 Nov 2017 12:22:25 +0000
Subject: [PATCH] Provide timespec_get() in C11 thread.h emulation on POSIX
 also

Signed-off-by: Jon Turney <jon.turney at dronecode.org.uk>
---
 include/c11/threads_posix.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/c11/threads_posix.h b/include/c11/threads_posix.h
index 7bf6a0f6ef6..25076f1b6e5 100644
--- a/include/c11/threads_posix.h
+++ b/include/c11/threads_posix.h
@@ -382,7 +382,6 @@ tss_set(tss_t key, void *val)
 
 /*-------------------- 7.25.7 Time functions --------------------*/
 // 7.25.6.1
-#if 0
 static inline int
 timespec_get(struct timespec *ts, int base)
 {
@@ -393,4 +392,3 @@ timespec_get(struct timespec *ts, int base)
     }
     return 0;
 }
-#endif
-- 
2.15.0



More information about the mesa-dev mailing list