summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Rühsen <tim.ruehsen@gmx.de>2019-05-10 11:42:46 +0200
committerTim Rühsen <tim.ruehsen@gmx.de>2019-05-17 09:44:13 +0200
commitbbc196e47d29b277560dea0e45aa01b352521de2 (patch)
tree401b1aad558831d87b83889ca4dbc27a69eaef23
parent610f7c2e8e724b6279e66b5062f57d24ee2dbcc9 (diff)
downloadgnutls-tmp-fix-gcc4.4.tar.gz
Fix _Thread_local for C99 installed in C11 environmentstmp-fix-gcc4.4
Signed-off-by: Tim Rühsen <tim.ruehsen@gmx.de>
-rw-r--r--lib/gthreads.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/gthreads.h b/lib/gthreads.h
index 02ab8d3da9..8a4e9e444a 100644
--- a/lib/gthreads.h
+++ b/lib/gthreads.h
@@ -25,9 +25,11 @@
#include <config.h>
-#ifdef HAVE_THREADS_H
+/* Using a C99-only compiler installed in parallel with modern C11 environment
+ * will see HAVE_THREADS_H, but won't be able to use _Thread_local. */
+#if __STDC_VERSION__ >= 201112 && !defined(__STDC_NO_THREADS__) && defined(HAVE_THREADS_H)
# include <threads.h>
-#elif defined(__GNUC__)
+#elif defined(__GNUC__) /* clang is also covered by __GNUC__ */
# define _Thread_local __thread
#elif defined(_MSC_VER)
# define _Thread_local __declspec(thread)