From 33e08697978d743612f948f21c86278bf87d2a70 Mon Sep 17 00:00:00 2001 From: guoshichao Date: Tue, 22 Oct 2024 14:13:46 +0800 Subject: [PATCH] ghs: fix the naked_function attr cannot handle warning with greenhills version older than 202354, the __attribute__((naked)) cannot handled by greenhills compiler, and will report warning: "/home/guoshichao/work_profile/vela_os/vela_car_6/nuttx/arch/arm/src/armv7-m/arm_svcall.c", line 79: warning #1097-D: unknown attribute "naked" static void dispatch_syscall(void) naked_function; ^ Signed-off-by: guoshichao --- include/nuttx/compiler.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 4a2d4f7249c0e..44936af580c46 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -240,7 +240,11 @@ * the function prolog and epilog. */ -# define naked_function __attribute__((naked,no_instrument_function)) +# if !defined(__ghs__) || __GHS_VERSION_NUMBER >= 202354 +# define naked_function __attribute__((naked,no_instrument_function)) +# else +# define naked_function +# endif /* The always_inline_function attribute informs GCC that the function should * always be inlined, regardless of the level of optimization. The