From f06b0894c452d9b0e5760f353fab18391b61662f Mon Sep 17 00:00:00 2001 From: Meco Man <920369182@qq.com> Date: Mon, 25 Dec 2023 21:08:47 +0800 Subject: [PATCH] [libc][picolibc] fix llvm compling warning /home/runner/work/rt-thread/rt-thread/components/libc/compilers/picolibc/syscall.c:24:16: warning: returning 'volatile int *' from a function with result type 'int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] return &__pico_errno; ^~~~~~~~~~~~~ /home/runner/work/rt-thread/rt-thread/components/libc/compilers/picolibc/syscall.c:30:16: warning: returning 'volatile int *' from a function with result type 'int *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] return &__pico_errno; ^~~~~~~~~~~~~ /home/runner/work/rt-thread/rt-thread/components/libc/compilers/picolibc/syscall.c:33:12: warning: incompatible pointer types returning 'rt_err_t *' (aka 'long *') from a function with result type 'int *' [-Wincompatible-pointer-types] return &tid->error; --- components/libc/compilers/picolibc/syscall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/components/libc/compilers/picolibc/syscall.c b/components/libc/compilers/picolibc/syscall.c index c2e45624f9..cf5622df84 100644 --- a/components/libc/compilers/picolibc/syscall.c +++ b/components/libc/compilers/picolibc/syscall.c @@ -21,16 +21,16 @@ int *pico_get_errno(void) if (rt_interrupt_get_nest() != 0) { /* it's in interrupt context */ - return &__pico_errno; + return (int *)&__pico_errno; } tid = rt_thread_self(); if (tid == RT_NULL) { - return &__pico_errno; + return (int *)&__pico_errno; } - return &tid->error; + return (int *)&tid->error; } #ifdef RT_USING_HEAP