Mesa (master): c11/threads: Include thr/ xtimec.h for xtime definition when building with MSVC.

Jose Fonseca jrfonseca at kemper.freedesktop.org
Wed Mar 29 10:53:36 UTC 2017


Module: Mesa
Branch: master
Commit: ecfafdcbf51d8919e219539b57ffbd9cd3f8557a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ecfafdcbf51d8919e219539b57ffbd9cd3f8557a

Author: Jose Fonseca <jfonseca at vmware.com>
Date:   Tue Mar 28 11:25:04 2017 +0100

c11/threads: Include thr/xtimec.h for xtime definition when building with MSVC.

MSVC has been including a xtime definition in thr/xtimec.h ever since
MSVC 2013 (which is the minimum we require for building Mesa), and
including it prevents duplicate definitions when it gets included by
LLVM.

In fact, it looks that MSVC has been including a partial C11 threads
implementation too for some time, which we should consider migrating to
once we eliminate the use of _MTX_INITIALIZER_NP in our tree.

Thanks to the anonymous helper from
https://bugs.freedesktop.org/show_bug.cgi?id=100201#c4 for spotting
this.

Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=100201
CC: "17.0" <mesa-stable at lists.freedesktop.org>

---

 include/c11/threads.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/c11/threads.h b/include/c11/threads.h
index 45823df35b..573348d809 100644
--- a/include/c11/threads.h
+++ b/include/c11/threads.h
@@ -30,6 +30,9 @@
 #define EMULATED_THREADS_H_INCLUDED_
 
 #include <time.h>
+#ifdef _MSC_VER
+#include <thr/xtimec.h>  // for xtime
+#endif
 
 #ifndef TIME_UTC
 #define TIME_UTC 1
@@ -41,11 +44,13 @@
 typedef void (*tss_dtor_t)(void*);
 typedef int (*thrd_start_t)(void*);
 
+#ifndef _MSC_VER
 struct xtime {
     time_t sec;
     long nsec;
 };
 typedef struct xtime xtime;
+#endif
 
 
 /*-------------------- enumeration constants --------------------*/




More information about the mesa-commit mailing list