From 7fdfd70b19c323f18580b602bc924c37bb67da6d Mon Sep 17 00:00:00 2001 From: Dave Rodgman Date: Thu, 15 Jun 2023 18:42:25 +0100 Subject: [PATCH] Introduce MBEDTLS_COMPILER_IS_GCC Signed-off-by: Dave Rodgman --- library/bn_mul.h | 6 +----- library/common.h | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/library/bn_mul.h b/library/bn_mul.h index c5994f704..aec7f2db8 100644 --- a/library/bn_mul.h +++ b/library/bn_mul.h @@ -661,14 +661,10 @@ #if defined(__arm__) #if defined(__thumb__) && !defined(__thumb2__) -#if !defined(__ARMCC_VERSION) && !defined(__clang__) \ - && !defined(__llvm__) && !defined(__INTEL_COMPILER) +#if defined(MBEDTLS_COMPILER_IS_GCC) /* * Thumb 1 ISA. This code path has only been tested successfully on gcc; * it does not compile on clang or armclang. - * - * Other compilers which define __GNUC__ may not work. The above macro - * attempts to exclude these untested compilers. */ #if !defined(__OPTIMIZE__) && defined(__GNUC__) diff --git a/library/common.h b/library/common.h index b48a1fc66..cfbff02ad 100644 --- a/library/common.h +++ b/library/common.h @@ -195,4 +195,10 @@ inline void mbedtls_xor(unsigned char *r, const unsigned char *a, const unsigned #define MBEDTLS_UNLIKELY(x) x #endif +#if defined(__GNUC__) && !defined(__ARMCC_VERSION) && !defined(__clang__) \ + && !defined(__llvm__) && !defined(__INTEL_COMPILER) +/* Defined if the compiler really is gcc and not clang, etc */ +#define MBEDTLS_COMPILER_IS_GCC +#endif + #endif /* MBEDTLS_LIBRARY_COMMON_H */