From fe55320b5c5563ff8bc62a8eb64d681e8a26905e Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Fri, 1 Sep 2023 11:15:28 +0100 Subject: [PATCH] Avoid error from old gcc version Signed-off-by: Dave Rodgman --- library/platform_util.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/platform_util.c b/library/platform_util.c index cfd982e4d..09216edfb 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -128,8 +128,9 @@ void mbedtls_platform_zeroize(void *buf, size_t len) #endif #if defined(__GNUC__) - /* For clang and gcc, pretend that we have some assembly that reads the + /* For clang and recent gcc, pretend that we have some assembly that reads the * zero'd memory as an additional protection against being optimised away. */ +#if defined(__clang__) || (__GNUC__ >= 10) #if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wvla" @@ -143,6 +144,7 @@ void mbedtls_platform_zeroize(void *buf, size_t len) #elif defined(MBEDTLS_COMPILER_IS_GCC) #pragma GCC diagnostic pop #endif +#endif #endif } }