From 1aed7869fffadc3a5b2bef4b9a9747fdb8244a70 Mon Sep 17 00:00:00 2001 From: Amy Chan Date: Wed, 29 Apr 2026 14:33:11 +0800 Subject: [PATCH] library/alignment.h: Fix 'MBEDTLS_GCC_VERSION' is not defined error Only check 'MBEDTLS_GCC_VERSION' when 'MBEDTLS_COMPILER_IS_GCC' is defined Signed-off-by: Amy Chan --- ChangeLog.d/mbedtls_gcc_version.txt | 2 ++ library/alignment.h | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 ChangeLog.d/mbedtls_gcc_version.txt diff --git a/ChangeLog.d/mbedtls_gcc_version.txt b/ChangeLog.d/mbedtls_gcc_version.txt new file mode 100644 index 0000000000..c3b475c82f --- /dev/null +++ b/ChangeLog.d/mbedtls_gcc_version.txt @@ -0,0 +1,2 @@ +Bugfix + * library/alignment.h: Fix 'MBEDTLS_GCC_VERSION' is not defined error diff --git a/library/alignment.h b/library/alignment.h index d304133382..b51656d5eb 100644 --- a/library/alignment.h +++ b/library/alignment.h @@ -280,7 +280,7 @@ static inline void mbedtls_put_unaligned_uint64(void *p, uint64_t x) /* * Detect GCC built-in byteswap routines */ -#if defined(__GNUC__) +#if defined(MBEDTLS_COMPILER_IS_GCC) #if MBEDTLS_GCC_VERSION >= 40800 #define MBEDTLS_BSWAP16 __builtin_bswap16 #endif @@ -288,7 +288,7 @@ static inline void mbedtls_put_unaligned_uint64(void *p, uint64_t x) #define MBEDTLS_BSWAP32 __builtin_bswap32 #define MBEDTLS_BSWAP64 __builtin_bswap64 #endif -#endif /* defined(__GNUC__) */ +#endif /* defined(MBEDTLS_COMPILER_IS_GCC) */ /* * Detect Clang built-in byteswap routines