From eb056315c389cf5077e445ebaf0c711f3b645bef Mon Sep 17 00:00:00 2001 From: xennex22 <25083624+xennex22@users.noreply.github.com> Date: Tue, 22 Sep 2020 06:53:36 -0700 Subject: [PATCH] Changed non-debug macro expansion (#1808) --- src/lv_conf_internal.h | 2 +- src/lv_core/lv_disp.c | 1 - src/lv_core/lv_disp.h | 1 - src/lv_core/lv_obj.c | 1 - src/lv_core/lv_obj.h | 4 +-- src/lv_core/lv_style.h | 8 +++--- src/lv_draw/lv_draw_mask.c | 4 --- src/lv_misc/lv_debug.h | 18 ++++++------ src/lv_misc/lv_log.h | 55 ++++++++---------------------------- src/lv_misc/lv_math.h | 2 -- src/lv_widgets/lv_keyboard.c | 4 ++- src/lv_widgets/lv_list.c | 4 ++- src/lv_widgets/lv_page.c | 1 - src/lv_widgets/lv_roller.c | 1 - src/lv_widgets/lv_table.c | 1 - src/lv_widgets/lv_textarea.c | 1 - 16 files changed, 33 insertions(+), 75 deletions(-) diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 0bc7aacbe..ea41b0720 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -1251,7 +1251,7 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */ /* Support bidirectional texts. * Allows mixing Left-to-Right and Right-to-Left texts. - * The direction will be processed according to the Unicode Bidirectioanl Algorithm: + * The direction will be processed according to the Unicode Bidirectional Algorithm: * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ #ifndef LV_USE_BIDI # ifdef CONFIG_LV_USE_BIDI diff --git a/src/lv_core/lv_disp.c b/src/lv_core/lv_disp.c index 80326f81d..9d0158aa8 100644 --- a/src/lv_core/lv_disp.c +++ b/src/lv_core/lv_disp.c @@ -120,7 +120,6 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp) return disp->sys_layer; } - /** * Assign a screen to a display. * @param disp pointer to a display where to assign the screen diff --git a/src/lv_core/lv_disp.h b/src/lv_core/lv_disp.h index 3083c46d2..00a9de8db 100644 --- a/src/lv_core/lv_disp.h +++ b/src/lv_core/lv_disp.h @@ -184,7 +184,6 @@ static inline void lv_scr_load(lv_obj_t * scr) lv_disp_load_scr(scr); } - /********************** * MACROS **********************/ diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index c555b320a..827c7311d 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -360,7 +360,6 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy) #if LV_USE_GROUP new_obj->group_p = NULL; - #endif /*Set attributes*/ diff --git a/src/lv_core/lv_obj.h b/src/lv_core/lv_obj.h index 3b97675ac..bcd923650 100644 --- a/src/lv_core/lv_obj.h +++ b/src/lv_core/lv_obj.h @@ -1527,11 +1527,11 @@ bool lv_debug_check_obj_valid(const lv_obj_t * obj); # if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/ # define LV_ASSERT_OBJ(obj_p, obj_type) LV_ASSERT_NULL(obj_p) # else -# define LV_ASSERT_OBJ(obj_p, obj_type) true +# define LV_ASSERT_OBJ(obj_p, obj_type) # endif # endif #else -# define LV_ASSERT_OBJ(obj, obj_type) true +# define LV_ASSERT_OBJ(obj, obj_type) #endif diff --git a/src/lv_core/lv_style.h b/src/lv_core/lv_style.h index 8d9d15d8e..4e1f74d97 100644 --- a/src/lv_core/lv_style.h +++ b/src/lv_core/lv_style.h @@ -618,13 +618,13 @@ bool lv_debug_check_style_list(const lv_style_list_t * list); # define LV_ASSERT_STYLE_LIST(list_p) LV_DEBUG_ASSERT(LV_DEBUG_IS_STYLE_LIST(list_p), "Invalid style list", list_p); # endif # else -# define LV_ASSERT_STYLE(style_p) true -# define LV_ASSERT_STYLE_LIST(list_p) true +# define LV_ASSERT_STYLE(style_p) +# define LV_ASSERT_STYLE_LIST(list_p) # endif #else -# define LV_ASSERT_STYLE(p) true -# define LV_ASSERT_STYLE_LIST(p) true +# define LV_ASSERT_STYLE(p) +# define LV_ASSERT_STYLE_LIST(p) #endif #ifdef __cplusplus diff --git a/src/lv_draw/lv_draw_mask.c b/src/lv_draw/lv_draw_mask.c index dcd1d4a9f..f7b8bc1ff 100644 --- a/src/lv_draw/lv_draw_mask.c +++ b/src/lv_draw/lv_draw_mask.c @@ -1,7 +1,3 @@ - - - - /** * @file lv_mask.c * diff --git a/src/lv_misc/lv_debug.h b/src/lv_misc/lv_debug.h index 2fa0fb95a..9160ceee8 100644 --- a/src/lv_misc/lv_debug.h +++ b/src/lv_misc/lv_debug.h @@ -81,7 +81,7 @@ void lv_debug_log_error(const char * msg, uint64_t value); # define LV_ASSERT_NULL(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "NULL pointer", p); # endif #else -# define LV_ASSERT_NULL(p) true +# define LV_ASSERT_NULL(p) #endif #if LV_USE_ASSERT_MEM @@ -89,7 +89,7 @@ void lv_debug_log_error(const char * msg, uint64_t value); # define LV_ASSERT_MEM(p) LV_DEBUG_ASSERT(LV_DEBUG_IS_NULL(p), "Out of memory", p); # endif #else -# define LV_ASSERT_MEM(p) true +# define LV_ASSERT_MEM(p) #endif #if LV_USE_ASSERT_MEM_INTEGRITY @@ -97,7 +97,7 @@ void lv_debug_log_error(const char * msg, uint64_t value); # define LV_ASSERT_MEM_INTEGRITY() LV_DEBUG_ASSERT(LV_DEBUG_CHECK_MEM_INTEGRITY(), "Memory integrity error", 0); # endif #else -# define LV_ASSERT_MEM_INTEGRITY() true +# define LV_ASSERT_MEM_INTEGRITY() #endif #if LV_USE_ASSERT_STR @@ -108,7 +108,7 @@ void lv_debug_log_error(const char * msg, uint64_t value); # if LV_USE_ASSERT_NULL /*Use at least LV_ASSERT_NULL if enabled*/ # define LV_ASSERT_STR(str) LV_ASSERT_NULL(str) # else -# define LV_ASSERT_STR(str) true +# define LV_ASSERT_STR(str) # endif #endif @@ -117,11 +117,11 @@ void lv_debug_log_error(const char * msg, uint64_t value); #define LV_DEBUG_ASSERT(expr, msg, value) do{}while(0) -#define LV_ASSERT_NULL(p) true -#define LV_ASSERT_MEM(p) true -#define LV_ASSERT_MEM_INTEGRITY() true -#define LV_ASSERT_STR(p) true -#define LV_ASSERT_OBJ(obj, obj_type) true +#define LV_ASSERT_NULL(p) +#define LV_ASSERT_MEM(p) +#define LV_ASSERT_MEM_INTEGRITY() +#define LV_ASSERT_STR(p) +#define LV_ASSERT_OBJ(obj, obj_type) #endif /* LV_USE_DEBUG */ /*clang-format on*/ diff --git a/src/lv_misc/lv_log.h b/src/lv_misc/lv_log.h index 7e07712eb..a85427e78 100644 --- a/src/lv_misc/lv_log.h +++ b/src/lv_misc/lv_log.h @@ -79,75 +79,42 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * #if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE #define LV_LOG_TRACE(...) _lv_log_add(LV_LOG_LEVEL_TRACE, __FILE__, __LINE__, __func__, __VA_ARGS__); #else -#define LV_LOG_TRACE(...) \ - { \ - ; \ - } +#define LV_LOG_TRACE(...) #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO #define LV_LOG_INFO(...) _lv_log_add(LV_LOG_LEVEL_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__); #else -#define LV_LOG_INFO(...) \ - { \ - ; \ - } +#define LV_LOG_INFO(...) #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN #define LV_LOG_WARN(...) _lv_log_add(LV_LOG_LEVEL_WARN, __FILE__, __LINE__, __func__, __VA_ARGS__); #else -#define LV_LOG_WARN(...) \ - { \ - ; \ - } +#define LV_LOG_WARN(...) #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR #define LV_LOG_ERROR(...) _lv_log_add(LV_LOG_LEVEL_ERROR, __FILE__, __LINE__, __func__, __VA_ARGS__); #else -#define LV_LOG_ERROR(...) \ - { \ - ; \ - } +#define LV_LOG_ERROR(...) #endif #if LV_LOG_LEVEL <= LV_LOG_LEVEL_USER #define LV_LOG_USER(...) _lv_log_add(LV_LOG_LEVEL_USER, __FILE__, __LINE__, __func__, __VA_ARGS__); #else -#define LV_LOG_USER(...) \ - { \ - ; \ - } +#define LV_LOG_USER(...) #endif #else /*LV_USE_LOG*/ /*Do nothing if `LV_USE_LOG 0`*/ -#define _lv_log_add(level, file, line, ...) \ - { \ - ; \ - } -#define LV_LOG_TRACE(...) \ - { \ - ; \ - } -#define LV_LOG_INFO(...) \ - { \ - ; \ - } -#define LV_LOG_WARN(...) \ - { \ - ; \ - } -#define LV_LOG_ERROR(...) \ - { \ - ; \ - } -#define LV_LOG_USER(...) \ - { \ - ; \ - } +#define _lv_log_add(level, file, line, ...) +#define LV_LOG_TRACE(...) +#define LV_LOG_INFO(...) +#define LV_LOG_WARN(...) +#define LV_LOG_ERROR(...) +#define LV_LOG_USER(...) #endif /*LV_USE_LOG*/ #ifdef __cplusplus diff --git a/src/lv_misc/lv_math.h b/src/lv_misc/lv_math.h index d4d626ef9..3c5600d2b 100644 --- a/src/lv_misc/lv_math.h +++ b/src/lv_misc/lv_math.h @@ -42,8 +42,6 @@ extern "C" { #define LV_BEZIER_VAL_MAX 1024 /**< Max time in Bezier functions (not [0..1] to use integers) */ #define LV_BEZIER_VAL_SHIFT 10 /**< log2(LV_BEZIER_VAL_MAX): used to normalize up scaled values*/ - - /********************** * TYPEDEFS **********************/ diff --git a/src/lv_widgets/lv_keyboard.c b/src/lv_widgets/lv_keyboard.c index 9138b171e..ae40b4deb 100644 --- a/src/lv_widgets/lv_keyboard.c +++ b/src/lv_widgets/lv_keyboard.c @@ -189,7 +189,9 @@ lv_obj_t * lv_keyboard_create(lv_obj_t * par, const lv_obj_t * copy) void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta) { LV_ASSERT_OBJ(kb, LV_OBJX_NAME); - if(ta) LV_ASSERT_OBJ(ta, "lv_textarea"); + if(ta) { + LV_ASSERT_OBJ(ta, "lv_textarea"); + } lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb); diff --git a/src/lv_widgets/lv_list.c b/src/lv_widgets/lv_list.c index e67135ba9..8ccdb0b33 100644 --- a/src/lv_widgets/lv_list.c +++ b/src/lv_widgets/lv_list.c @@ -276,7 +276,9 @@ bool lv_list_remove(const lv_obj_t * list, uint16_t index) void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn) { LV_ASSERT_OBJ(list, LV_OBJX_NAME); - if(btn) LV_ASSERT_OBJ(btn, "lv_btn"); + if(btn) { + LV_ASSERT_OBJ(btn, "lv_btn"); + } lv_list_ext_t * ext = lv_obj_get_ext_attr(list); diff --git a/src/lv_widgets/lv_page.c b/src/lv_widgets/lv_page.c index 03c15bcc3..2400dccd3 100644 --- a/src/lv_widgets/lv_page.c +++ b/src/lv_widgets/lv_page.c @@ -132,7 +132,6 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_set_signal_cb(page, lv_page_signal); lv_obj_set_design_cb(page, lv_page_design); - lv_page_set_scrollbar_mode(page, ext->scrlbar.mode); lv_theme_apply(page, LV_THEME_PAGE); diff --git a/src/lv_widgets/lv_roller.c b/src/lv_widgets/lv_roller.c index b412470b4..0e8b12ceb 100644 --- a/src/lv_widgets/lv_roller.c +++ b/src/lv_widgets/lv_roller.c @@ -1,4 +1,3 @@ - /** * @file lv_roller.c * diff --git a/src/lv_widgets/lv_table.c b/src/lv_widgets/lv_table.c index b71135176..bcaf7565b 100644 --- a/src/lv_widgets/lv_table.c +++ b/src/lv_widgets/lv_table.c @@ -974,7 +974,6 @@ static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part) static void refr_size(lv_obj_t * table) { - lv_coord_t h = 0; lv_coord_t w = 0; diff --git a/src/lv_widgets/lv_textarea.c b/src/lv_widgets/lv_textarea.c index 2b1489462..2233ce281 100644 --- a/src/lv_widgets/lv_textarea.c +++ b/src/lv_widgets/lv_textarea.c @@ -260,7 +260,6 @@ void lv_textarea_add_char(lv_obj_t * ta, uint32_t c) return; } - /*If a new line was added it shouldn't show edge flash effect*/ bool edge_flash_en = lv_textarea_get_edge_flash(ta); lv_textarea_set_edge_flash(ta, false);