From 52b90532f630fe1e6387a0af11424d33be1cf094 Mon Sep 17 00:00:00 2001 From: Scr3amer Date: Fri, 1 Sep 2023 17:37:36 -0400 Subject: [PATCH] Define TLS as _Thread_local if the compiler supports C11 (#1304) --- .../randombytes/internal/randombytes_internal_random.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsodium/randombytes/internal/randombytes_internal_random.c b/src/libsodium/randombytes/internal/randombytes_internal_random.c index f0794f80ac..1176cd6677 100644 --- a/src/libsodium/randombytes/internal/randombytes_internal_random.c +++ b/src/libsodium/randombytes/internal/randombytes_internal_random.c @@ -93,6 +93,10 @@ 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 # define TLS __declspec(thread)