From dba2b47d45d8b46a960110d1d7d0549d40d17abb Mon Sep 17 00:00:00 2001 From: armink Date: Thu, 14 Mar 2019 20:37:30 +0800 Subject: Sync from master (fc5cfe0a5e5709878f50b904df7c3355078941dd) --- include/libc/libc_errno.h | 2 +- include/rtdbg.h | 35 ++++++++++++----------------------- include/rtthread.h | 1 + 3 files changed, 14 insertions(+), 24 deletions(-) (limited to 'include') diff --git a/include/libc/libc_errno.h b/include/libc/libc_errno.h index d693c01fd6..bb9a4dea2a 100644 --- a/include/libc/libc_errno.h +++ b/include/libc/libc_errno.h @@ -161,7 +161,7 @@ defined in armcc/errno.h #define EPROTONOSUPPORT (ERROR_BASE_NO + 93) #define ESOCKTNOSUPPORT (ERROR_BASE_NO + 94) #define EOPNOTSUPP (ERROR_BASE_NO + 95) -#define ENOTSUP EOPNOTSUPP +#define ENOTSUP EOPNOTSUPP #define EPFNOSUPPORT (ERROR_BASE_NO + 96) #define EAFNOSUPPORT (ERROR_BASE_NO + 97) #define EADDRINUSE (ERROR_BASE_NO + 98) diff --git a/include/rtdbg.h b/include/rtdbg.h index 9036a0cd66..77382c656b 100644 --- a/include/rtdbg.h +++ b/include/rtdbg.h @@ -19,16 +19,12 @@ * header file. * * #define DBG_SECTION_NAME "MOD" - * #define DBG_ENABLE // enable debug macro * #define DBG_LEVEL DBG_INFO - * #include // must after of DEBUG_ENABLE or some other options + * #include // must after of DBG_LEVEL, DBG_SECTION_NAME or other options * * Then in your C/C++ file, you can use LOG_X macro to print out logs: * LOG_D("this is a debug log!"); * LOG_E("this is a error log!"); - * - * If you want to use different color for different kinds log, you can - * #define DBG_COLOR */ #ifndef RT_DBG_H__ @@ -36,7 +32,17 @@ #include -#if defined(RT_USING_ULOG) && defined(DBG_ENABLE) +/* the debug log will force enable when RT_DEBUG macro is defined */ +#if defined(RT_DEBUG) && !defined(DBG_ENABLE) +#define DBG_ENABLE +#endif + +/* it will force output color log when RT_DEBUG_COLOR macro is defined */ +#if defined(RT_DEBUG_COLOR) && !defined(DBG_COLOR) +#define DBG_COLOR +#endif + +#if defined(RT_USING_ULOG) /* using ulog compatible with rtdbg */ #include #else @@ -108,23 +114,6 @@ __FUNCTION__, __LINE__); \ } -#define dbg_enter \ - if ((DBG_LEVEL) <= DBG_LOG){ \ - _DBG_COLOR(32); \ - rt_kprintf(DBG_SECTION_NAME " Enter %s\n", \ - __FUNCTION__); \ - _DBG_COLOR(0); \ - } - -#define dbg_exit \ - if ((DBG_LEVEL) <= DBG_LOG){ \ - _DBG_COLOR(32); \ - rt_kprintf(DBG_SECTION_NAME " Exit %s:%d\n", \ - __FUNCTION__); \ - _DBG_COLOR(0); \ - } - - #define dbg_log_line(lvl, color_n, fmt, ...) \ do \ { \ diff --git a/include/rtthread.h b/include/rtthread.h index 96ebe1940a..5d3fd3def6 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -497,6 +497,7 @@ void *rt_memcpy(void *dest, const void *src, rt_ubase_t n); rt_int32_t rt_strncmp(const char *cs, const char *ct, rt_ubase_t count); rt_int32_t rt_strcmp(const char *cs, const char *ct); rt_size_t rt_strlen(const char *src); +rt_size_t rt_strnlen(const char *s, rt_ubase_t maxlen); char *rt_strdup(const char *s); #if defined(__CC_ARM) || defined(__CLANG_ARM) /* leak strdup interface */ -- cgit v1.3.1