From 6b7f1177deeae01a7092c22a89cd41e7b318f01c Mon Sep 17 00:00:00 2001 From: KunYi Chen Date: Fri, 25 Oct 2024 12:14:39 +0800 Subject: fix: suppress unused warnings when DEBUG disabled When RT_USING_DEBUG is disabled, variables used only in RT_ASSERT statements become unused, triggering -Wunused-but-set-variable compiler warnings. These variables are essential for runtime assertions in debug builds but appear unused in release builds. Example: - Variables used in RT_ASSERT(var != RT_NULL) checks - Affects multiple drivers and components using RT_ASSERT This is a general cleanup to improve code compilation without affecting functionality. --- include/rtthread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/rtthread.h') diff --git a/include/rtthread.h b/include/rtthread.h index 311516bd8b..e6740d46da 100644 --- a/include/rtthread.h +++ b/include/rtthread.h @@ -804,7 +804,7 @@ if (!(EX)) \ rt_assert_handler(#EX, __FUNCTION__, __LINE__); \ } #else -#define RT_ASSERT(EX) +#define RT_ASSERT(EX) {RT_UNUSED(EX);} #endif /* RT_DEBUGING_ASSERT */ #ifdef RT_DEBUGING_CONTEXT -- cgit v1.3.1