From ba67451562cdf5c7956d3063f9519018af54eb3c Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Fri, 1 Sep 2023 10:14:46 +0100 Subject: [PATCH] Fix gcc compile warnings Signed-off-by: Dave Rodgman --- library/platform_util.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/library/platform_util.c b/library/platform_util.c index d4574f459e..06c7820844 100644 --- a/library/platform_util.c +++ b/library/platform_util.c @@ -130,10 +130,19 @@ void mbedtls_platform_zeroize(void *buf, size_t len) #if defined(__GNUC__) /* For clang and gcc, pretend that we have some assembly that reads the * zero'd memory as an additional protection against being optimised away. */ +#if defined(__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wvla" +#elif defined(MBEDTLS_COMPILER_IS_GCC) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wvla" +#endif asm volatile ("" : : "m" (*(char (*)[len]) buf) : ); +#if defined(__clang__) #pragma clang diagnostic pop +#elif defined(MBEDTLS_COMPILER_IS_GCC) +#pragma GCC diagnostic pop +#endif #endif } }