From 7dfb6121fc5b7fb8d088f67a46519795486c744d Mon Sep 17 00:00:00 2001 From: David Horstmann Date: Tue, 23 Jan 2024 15:35:20 +0000 Subject: [PATCH] Remove _Thread_local variable for 2.28 We do not intend to support multithreaded testing in 2.28, so introducing a C11 feature here is an unnecessary burden. Signed-off-by: David Horstmann --- tests/include/test/memory.h | 13 +++++-------- tests/src/test_memory.c | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/include/test/memory.h b/tests/include/test/memory.h index 91be573b9..d4bbeec0d 100644 --- a/tests/include/test/memory.h +++ b/tests/include/test/memory.h @@ -21,12 +21,9 @@ * memory as poisoned, which can be used to enforce some memory access * policies. * - * Support for the C11 thread_local keyword is also required. - * * Currently, only Asan (Address Sanitizer) is supported. */ -#if defined(MBEDTLS_TEST_HAVE_ASAN) && \ - (__STDC_VERSION__ >= 201112L) +#if defined(MBEDTLS_TEST_HAVE_ASAN) # define MBEDTLS_TEST_MEMORY_CAN_POISON #endif @@ -64,11 +61,11 @@ #if defined(MBEDTLS_TEST_MEMORY_CAN_POISON) -/** Thread-local variable used to enable memory poisoning. This is set and - * unset in the test wrappers so that calls to PSA functions from the library - * do not poison memory. +/** Variable used to enable memory poisoning. This is set and unset in the + * test wrappers so that calls to PSA functions from the library do not + * poison memory. */ -extern _Thread_local unsigned int mbedtls_test_memory_poisoning_count; +extern unsigned int mbedtls_test_memory_poisoning_count; /** Poison a memory area so that any attempt to read or write from it will * cause a runtime failure. diff --git a/tests/src/test_memory.c b/tests/src/test_memory.c index ac9dde616..9da7f20a3 100644 --- a/tests/src/test_memory.c +++ b/tests/src/test_memory.c @@ -20,7 +20,7 @@ #if defined(MBEDTLS_TEST_MEMORY_CAN_POISON) -_Thread_local unsigned int mbedtls_test_memory_poisoning_count = 0; +unsigned int mbedtls_test_memory_poisoning_count = 0; static void align_for_asan(const unsigned char **p_ptr, size_t *p_size) {