From f7ba4a63413cf6a0d64ea03f7cb63eb58d1ad099 Mon Sep 17 00:00:00 2001 From: Meco <920369182@qq.com> Date: Wed, 5 Aug 2020 02:47:27 +0800 Subject: 增加条件编译,防止RT_USING_DFS没有定义时 _sys_flen()出现编译警告:stat变量定义但没有被调用 的问题 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/libc/compilers/armlibc/stubs.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index b6ffb37b0f..8acde16495 100644 --- a/components/libc/compilers/armlibc/stubs.c +++ b/components/libc/compilers/armlibc/stubs.c @@ -9,6 +9,8 @@ * 2013-11-24 aozima fixed _sys_read()/_sys_write() issues. * 2014-08-03 bernard If using msh, use system() implementation * in msh. + * 2020-08-05 Meco Man fixed _sys_flen() compiling-warning when + * RT_USING_DFS is not defined */ #include @@ -265,7 +267,9 @@ RT_WEAK void _sys_exit(int return_code) */ long _sys_flen(FILEHANDLE fh) { +#ifdef RT_USING_DFS struct stat stat; +#endif if (fh < STDERR) return -1; -- cgit v1.3.1 From 576475f14f66e3bc73fcef434ca51bb37420d49d Mon Sep 17 00:00:00 2001 From: Meco <920369182@qq.com> Date: Wed, 5 Aug 2020 09:28:10 +0800 Subject: change format --- components/libc/compilers/armlibc/stubs.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'components/libc/compilers') diff --git a/components/libc/compilers/armlibc/stubs.c b/components/libc/compilers/armlibc/stubs.c index 8acde16495..b4cc13799e 100644 --- a/components/libc/compilers/armlibc/stubs.c +++ b/components/libc/compilers/armlibc/stubs.c @@ -269,16 +269,14 @@ long _sys_flen(FILEHANDLE fh) { #ifdef RT_USING_DFS struct stat stat; -#endif - + if (fh < STDERR) return -1; -#ifndef RT_USING_DFS - return -1; -#else fstat(fh, &stat); return stat.st_size; +#else + return -1; #endif } -- cgit v1.3.1