feat(assert): support format string in assert message (#5392)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu
2024-01-19 17:39:10 +08:00
committed by GitHub
parent 214d72da88
commit 24115615bc
+2 -2
View File
@@ -42,10 +42,10 @@ extern "C" {
} \ } \
} while(0) } while(0)
#define LV_ASSERT_MSG(expr, msg) \ #define LV_ASSERT_MSG(expr, format, ...) \
do { \ do { \
if(!(expr)) { \ if(!(expr)) { \
LV_LOG_ERROR("Asserted at expression: %s (%s)", #expr, msg); \ LV_LOG_ERROR("Asserted at expression: %s " format , #expr, ##__VA_ARGS__); \
LV_ASSERT_HANDLER \ LV_ASSERT_HANDLER \
} \ } \
} while(0) } while(0)