[libc] remove strdup from rtthread.h (#6026)

add __STDC_LIMIT_MACROS macro in Keil
add RT_USING_LIBC in simulator
add _DLIB_ADD_EXTRA_SYMBOLS=0 in IAR
This commit is contained in:
Man, Jianting (Meco) 2022-06-04 05:02:35 -04:00 committed by GitHub
parent 02b176f8cb
commit fb3f835089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 17 deletions

View File

@ -8,7 +8,7 @@ src = ['board.c', 'uart_console.c']
LIBS = []
LIBPATH = []
CPPPATH = [cwd]
CPPDEFINES = []
CPPDEFINES = ['RT_USING_LIBC']
if rtconfig.CROSS_TOOL == 'msvc':
CPPDEFINES += \

View File

@ -4,7 +4,7 @@ Import('rtconfig')
src = Glob('*.c')
group = []
CPPDEFINES = ['RT_USING_ARM_LIBC', 'RT_USING_LIBC']
CPPDEFINES = ['RT_USING_ARM_LIBC', 'RT_USING_LIBC', '__STDC_LIMIT_MACROS']
if rtconfig.PLATFORM in ['armcc', 'armclang']:
group = DefineGroup('Compiler', src, depend = [''], CPPDEFINES = CPPDEFINES)

View File

@ -4,7 +4,7 @@ Import('rtconfig')
src = Glob('*.c')
group = []
CPPDEFINES = ['RT_USING_DLIBC', 'RT_USING_LIBC']
CPPDEFINES = ['RT_USING_DLIBC', 'RT_USING_LIBC', '_DLIB_ADD_EXTRA_SYMBOLS=0']
if rtconfig.PLATFORM == 'iar':
if GetDepend('DFS_USING_POSIX'):

View File

@ -605,7 +605,8 @@ void *rt_memcpy(void *dest, const void *src, rt_ubase_t n);
void *rt_memmove(void *dest, const void *src, rt_size_t n);
rt_int32_t rt_memcmp(const void *cs, const void *ct, rt_size_t count);
#endif /* RT_KSERVICE_USING_STDLIB_MEMORY */
char *rt_strdup(const char *s);
rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen);
#ifndef RT_KSERVICE_USING_STDLIB
char *rt_strstr(const char *str1, const char *str2);
rt_int32_t rt_strcasecmp(const char *a, const char *b);
@ -631,19 +632,6 @@ rt_size_t rt_strlen(const char *src);
#define rt_strlen(src) strlen(src)
#endif /*RT_KSERVICE_USING_STDLIB*/
char *rt_strdup(const char *s);
#if !defined(RT_KSERVICE_USING_STDLIB) || defined(__ARMCC_VERSION)
rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen);
#else
#define rt_strnlen(s, maxlen) strnlen(s, maxlen)
#endif /* !defined(RT_KSERVICE_USING_STDLIB) || defined(__ARMCC_VERSION) */
#ifdef __ARMCC_VERSION
/* MDK doesn't have these APIs */
rt_size_t strnlen(const char *s, rt_size_t maxlen);
#endif /* __ARMCC_VERSION */
void rt_show_version(void);
#ifdef RT_DEBUG