From bd6402c5db9e42de1e38fc654622a24d50b6e2dc Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 4 Apr 2026 11:12:55 +0200 Subject: [PATCH] Define TLS as _Thread_local only if not properly autoconfigured --- .../randombytes/internal/randombytes_internal_random.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/libsodium/randombytes/internal/randombytes_internal_random.c b/src/libsodium/randombytes/internal/randombytes_internal_random.c index faf52659..33c04ad6 100644 --- a/src/libsodium/randombytes/internal/randombytes_internal_random.c +++ b/src/libsodium/randombytes/internal/randombytes_internal_random.c @@ -91,12 +91,11 @@ 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(CONFIGURED) && !defined(__STDC_NO_THREADS__) && \ + defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +# define TLS _Thread_local +# elif defined(_WIN32) # define TLS __declspec(thread) # else # define TLS