From 8ad54cb636316112de4a113fc51185ca56499bc8 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 1 Sep 2023 23:43:21 +0200 Subject: [PATCH] Fallback to _Thread_local on C11 regardless of the platform --- .../randombytes/internal/randombytes_internal_random.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libsodium/randombytes/internal/randombytes_internal_random.c b/src/libsodium/randombytes/internal/randombytes_internal_random.c index 5cee984f..cd9681c9 100644 --- a/src/libsodium/randombytes/internal/randombytes_internal_random.c +++ b/src/libsodium/randombytes/internal/randombytes_internal_random.c @@ -96,13 +96,13 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); # endif #endif +#if !defined(TLS) && !defined(__STDC_NO_THREADS__) && \ + defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define TLS _Thread_local +#endif #ifndef TLS # ifdef _WIN32 -# if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L) -# define TLS _Thread_local -# else -# define TLS __declspec(thread) -# endif +# define TLS __declspec(thread) # else # define TLS # endif