Skip to content

Commit

Permalink
Uniformly use MBEDTLS_THREADING_C guards
Browse files Browse the repository at this point in the history
Since the code compiles with MBEDTLS_THREADING_C, not just with
MBEDTLS_THREADING_PTHREAD, use MBEDTLS_THREADING_C as the guard. The runtime
behavior is only as desired under certain conditions that imply
MBEDTLS_THREADING_PTHREAD, but that's fine: no metatest is expected to pass
in all scenarios, only under specific build- and run-time conditions.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
  • Loading branch information
gilles-peskine-arm committed Nov 16, 2023
1 parent d4084fd commit 96c87c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions programs/test/metatest.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void mutex_lock_not_initialized(const char *name)
(void) name;
/* Mutex usage verification is only done with pthread, not with other
* threading implementations. See tests/src/threading_helpers.c. */
#if defined(MBEDTLS_THREADING_PTHREAD)
#if defined(MBEDTLS_THREADING_C)
mbedtls_threading_mutex_t mutex;
memset(&mutex, 0, sizeof(mutex));
TEST_ASSERT(mbedtls_mutex_lock(&mutex) == 0);
Expand Down Expand Up @@ -203,7 +203,7 @@ void mutex_leak(const char *name)
(void) name;
/* Mutex usage verification is only done with pthread, not with other
* threading implementations. See tests/src/threading_helpers.c. */
#if defined(MBEDTLS_THREADING_PTHREAD)
#if defined(MBEDTLS_THREADING_C)
mbedtls_threading_mutex_t mutex;
mbedtls_mutex_init(&mutex);
#endif
Expand Down

0 comments on commit 96c87c4

Please sign in to comment.