From a04c8687ac66ff2632c755fc29596737fe524503 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 is compiler supports C11 (#1304) This avoids having warnings when compiling with Clang-MinGW on windows. --- .../randombytes/internal/randombytes_internal_random.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libsodium/randombytes/internal/randombytes_internal_random.c b/src/libsodium/randombytes/internal/randombytes_internal_random.c index 1446d1f3..5cee984f 100644 --- a/src/libsodium/randombytes/internal/randombytes_internal_random.c +++ b/src/libsodium/randombytes/internal/randombytes_internal_random.c @@ -98,7 +98,11 @@ BOOLEAN NTAPI RtlGenRandom(PVOID RandomBuffer, ULONG RandomBufferLength); #ifndef TLS # ifdef _WIN32 -# define TLS __declspec(thread) +# if (defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L) +# define TLS _Thread_local +# else +# define TLS __declspec(thread) +# endif # else # define TLS # endif