From acf04f1087d731f33f5d834cd035d0d9cd4cdfcb Mon Sep 17 00:00:00 2001 From: akallabeth Date: Wed, 10 Dec 2025 14:39:55 +0100 Subject: [PATCH] [winpr,platform] add C11 thread_local support --- winpr/include/winpr/platform.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/winpr/include/winpr/platform.h b/winpr/include/winpr/platform.h index e740b5351..3a07199b5 100644 --- a/winpr/include/winpr/platform.h +++ b/winpr/include/winpr/platform.h @@ -595,7 +595,12 @@ WINPR_PRAGMA_DIAG_POP // WARNING: *do not* use thread-local storage for new code because it is not portable // It is only used for VirtualChannelInit, and all FreeRDP channels use VirtualChannelInitEx // The old virtual channel API is only realistically used on Windows where TLS is available -#if defined _WIN32 || defined __CYGWIN__ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(__STDC_NO_THREADS__) // C11 +#include + +#define WINPR_TLS thread_local +#elif defined _WIN32 || defined __CYGWIN__ #ifdef __GNUC__ #define WINPR_TLS __thread #else