From 1a5bf10ca08c06be10857c224c5fd70ef38591f2 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Mon, 16 Mar 2026 23:45:49 +0100 Subject: [PATCH] Declare platform requirements for test helpers before including any system header If we rely on `tf_psa_crypto_common.h`, it's too late. And `common.h in 3.6 doesn't have platform requirements. Signed-off-by: Gilles Peskine --- tests/src/test_common.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/src/test_common.h b/tests/src/test_common.h index c5cce8241..7053fec64 100644 --- a/tests/src/test_common.h +++ b/tests/src/test_common.h @@ -14,6 +14,18 @@ #ifndef TEST_TEST_COMMON_H #define TEST_TEST_COMMON_H +#if !defined(_POSIX_C_SOURCE) +/* For standards-compliant access to + * clock_gettime(), gmtime_r(), ... + */ +#define _POSIX_C_SOURCE 200112L +#endif + +/* With GNU libc, define all the things, even when compiling with -pedantic. */ +#if !defined(_GNU_SOURCE) +#define _GNU_SOURCE +#endif + /* On Mingw-w64, force the use of a C99-compliant printf() and friends. * This is necessary on older versions of Mingw and/or Windows runtimes * where snprintf does not always zero-terminate the buffer, and does