From bd228eb9c538f55d69e535db36ef26aab36bb79c Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 19 Feb 2024 14:51:42 -0500 Subject: [PATCH] [ci] fix errors under strick compiling mode --- components/lwp/lwp_user_mm.h | 2 ++ libcpu/risc-v/virt64/cache.h | 49 ++++++++++++++++++++++++++++-------- src/idle.c | 2 ++ src/kservice.c | 10 ++++++++ src/mem.c | 10 -------- src/scheduler_mp.c | 3 +++ src/signal.c | 3 +++ 7 files changed, 58 insertions(+), 21 deletions(-) diff --git a/components/lwp/lwp_user_mm.h b/components/lwp/lwp_user_mm.h index a63b19f3cd..cfc5b57152 100644 --- a/components/lwp/lwp_user_mm.h +++ b/components/lwp/lwp_user_mm.h @@ -207,6 +207,8 @@ rt_inline rt_size_t lwp_user_mm_flag_to_kernel(int flags) rt_inline rt_size_t lwp_user_mm_attr_to_kernel(int prot) { + RT_UNUSED(prot); + rt_size_t k_attr = 0; #ifdef IMPL_MPROTECT diff --git a/libcpu/risc-v/virt64/cache.h b/libcpu/risc-v/virt64/cache.h index 5529e02458..4ee8532736 100644 --- a/libcpu/risc-v/virt64/cache.h +++ b/libcpu/risc-v/virt64/cache.h @@ -10,25 +10,52 @@ #ifndef __CACHE_H__ #define __CACHE_H__ -#ifndef ALWAYS_INLINE -#define ALWAYS_INLINE inline __attribute__((always_inline)) -#endif +#include /** * @brief These APIs may not be supported by a specified architecture * But we have to include to all the cases to be 'general purpose' */ -ALWAYS_INLINE void rt_hw_cpu_dcache_clean_local(void *addr, int size) {} -ALWAYS_INLINE void rt_hw_cpu_dcache_invalidate_local(void *addr, int size) {} -ALWAYS_INLINE void rt_hw_cpu_dcache_clean_and_invalidate_local(void *addr, int size) {} +rt_always_inline void rt_hw_cpu_dcache_clean_local(void *addr, int size) +{ + RT_UNUSED(addr); + RT_UNUSED(size); +} -ALWAYS_INLINE void rt_hw_cpu_dcache_clean_all_local() {} -ALWAYS_INLINE void rt_hw_cpu_dcache_invalidate_all_local(void) {} -ALWAYS_INLINE void rt_hw_cpu_dcache_clean_and_invalidate_all_local(void) {} +rt_always_inline void rt_hw_cpu_dcache_invalidate_local(void *addr, int size) +{ + RT_UNUSED(addr); + RT_UNUSED(size); +} -ALWAYS_INLINE void rt_hw_cpu_icache_invalidate_local(void *addr, int size) {} -ALWAYS_INLINE void rt_hw_cpu_icache_invalidate_all_local() {} +rt_always_inline void rt_hw_cpu_dcache_clean_and_invalidate_local(void *addr, int size) +{ + RT_UNUSED(addr); + RT_UNUSED(size); +} + +rt_always_inline void rt_hw_cpu_dcache_clean_all_local(void) +{ +} + +rt_always_inline void rt_hw_cpu_dcache_invalidate_all_local(void) +{ +} + +rt_always_inline void rt_hw_cpu_dcache_clean_and_invalidate_all_local(void) +{ +} + +rt_always_inline void rt_hw_cpu_icache_invalidate_local(void *addr, int size) +{ + RT_UNUSED(addr); + RT_UNUSED(size); +} + +rt_always_inline void rt_hw_cpu_icache_invalidate_all_local(void) +{ +} /** * @brief Multi-core diff --git a/src/idle.c b/src/idle.c index 04bc22ce14..279a3c76aa 100644 --- a/src/idle.c +++ b/src/idle.c @@ -304,6 +304,8 @@ static void idle_thread_entry(void *parameter) #ifdef RT_USING_SMP static void rt_thread_system_entry(void *parameter) { + RT_UNUSED(parameter); + while (1) { int ret= rt_sem_take(&system_sem, RT_WAITING_FOREVER); diff --git a/src/kservice.c b/src/kservice.c index 62e591412f..23be476db4 100644 --- a/src/kservice.c +++ b/src/kservice.c @@ -1026,6 +1026,11 @@ static char *print_number(char *buf, return buf; } +#ifdef __GNUC__ +#pragma GCC diagnostic push +/* ignore warning: this statement may fall through */ +#pragma GCC diagnostic ignored "-Wimplicit-fallthrough" +#endif /* __GNUC__ */ /** * @brief This function will fill a formatted string to buffer. * @@ -1345,6 +1350,9 @@ rt_weak int rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list arg return str - buf; } RTM_EXPORT(rt_vsnprintf); +#ifdef __GNUC__ +#pragma GCC diagnostic pop /* ignored "-Wimplicit-fallthrough" */ +#endif /* __GNUC__ */ /** * @brief This function will fill a formatted string to buffer. @@ -1568,6 +1576,8 @@ static void _console_release(void) */ static void _kputs(const char *str, long len) { + RT_UNUSED(len); + CONSOLE_TAKE; #ifdef RT_USING_DEVICE diff --git a/src/mem.c b/src/mem.c index 0704e29562..d0bfca9a9a 100644 --- a/src/mem.c +++ b/src/mem.c @@ -290,16 +290,6 @@ void *rt_smem_alloc(rt_smem_t m, rt_size_t size) RT_ASSERT(rt_object_get_type(&m->parent) == RT_Object_Class_Memory); RT_ASSERT(rt_object_is_systemobject(&m->parent)); - if (size != RT_ALIGN(size, RT_ALIGN_SIZE)) - { - LOG_D("malloc size %d, but align to %d", - size, RT_ALIGN(size, RT_ALIGN_SIZE)); - } - else - { - LOG_D("malloc size %d", size); - } - small_mem = (struct rt_small_mem *)m; /* alignment size */ size = RT_ALIGN(size, RT_ALIGN_SIZE); diff --git a/src/scheduler_mp.c b/src/scheduler_mp.c index fdd148b1ca..66404f3352 100644 --- a/src/scheduler_mp.c +++ b/src/scheduler_mp.c @@ -249,6 +249,9 @@ void rt_system_scheduler_init(void) */ void rt_scheduler_ipi_handler(int vector, void *param) { + RT_UNUSED(vector); + RT_UNUSED(param); + rt_schedule(); } diff --git a/src/signal.c b/src/signal.c index 9d4b4c4148..becf400dc8 100644 --- a/src/signal.c +++ b/src/signal.c @@ -41,12 +41,15 @@ void rt_thread_handle_sig(rt_bool_t clean_state); static void _signal_default_handler(int signo) { + RT_UNUSED(signo); LOG_I("handled signo[%d] with default action.", signo); return ; } static void _signal_entry(void *parameter) { + RT_UNUSED(parameter); + rt_thread_t tid = rt_thread_self(); /* handle signal */