Forráskód Böngészése

增加 __GNUC__宏定义 和sconscript的平台识别以避免重复定义

mysterywolf 5 éve
szülő
commit
ff097f0467

+ 2 - 1
components/libc/compilers/common/SConscript

@@ -16,6 +16,7 @@ else:
 if GetDepend('RT_USING_POSIX') == False:
         SrcRemove(src, ['unistd.c'])
 
-group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH)
+if not GetDepend('RT_USING_MINILIBC') and GetDepend('RT_USING_LIBC'):
+	group = DefineGroup('libc', src, depend = [''], CPPPATH = CPPPATH)
 
 Return('group')

+ 1 - 1
components/libc/compilers/minilibc/SConscript

@@ -8,7 +8,7 @@ group = []
 CPPPATH = [cwd]
 CPPDEFINES = ['RT_USING_MINILIBC']
 
-if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC'):
+if rtconfig.PLATFORM == 'gcc' and rtconfig.ARCH != 'sim' and not GetDepend('RT_USING_LIBC') and GetDepend('RT_USING_MINILIBC'):
     group = DefineGroup('libc', src, depend = [''],
         CPPPATH = CPPPATH, CPPDEFINES = CPPDEFINES)
 

+ 2 - 2
include/libc/libc_errno.h

@@ -13,7 +13,7 @@
 
 #include <rtconfig.h>
 
-#if defined(RT_USING_NEWLIB) || defined(_WIN32)
+#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined( __GNUC__ )
 /* use errno.h file in toolchains */
 #include <errno.h>
 #endif
@@ -45,7 +45,7 @@ defined in armcc/errno.h
 #define ERROR_BASE_NO    0
 #endif
 
-#if !defined(RT_USING_NEWLIB) && !defined(_WIN32)
+#if !defined(RT_USING_NEWLIB) && !defined(_WIN32) && !defined(__GNUC__ )
 
 #define EPERM            (ERROR_BASE_NO + 1)
 #define ENOENT           (ERROR_BASE_NO + 2)

+ 1 - 1
include/libc/libc_fcntl.h

@@ -12,7 +12,7 @@
 #ifndef LIBC_FCNTL_H__
 #define LIBC_FCNTL_H__
 
-#if defined(RT_USING_NEWLIB) || defined(_WIN32)
+#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined( __GNUC__ )
 #include <fcntl.h>
 
 #ifndef O_NONBLOCK

+ 1 - 1
include/libc/libc_fdset.h

@@ -13,7 +13,7 @@
 
 #include <rtconfig.h>
 
-#if defined(RT_USING_NEWLIB) || defined(_WIN32)
+#if defined(RT_USING_NEWLIB) || defined(_WIN32) || defined( __GNUC__ )
 #include <sys/types.h>
 #if defined(HAVE_SYS_SELECT_H)
 #include <sys/select.h>

+ 1 - 1
include/libc/libc_stat.h

@@ -9,7 +9,7 @@
 
 #include <rtconfig.h>
 
-#if defined(RT_USING_NEWLIB)
+#if defined(RT_USING_NEWLIB) || defined( __GNUC__ )
 /* use header file of newlib */
 #include <sys/stat.h>