This is an automated email from the ASF dual-hosted git repository. masayuki pushed a commit to branch revert-11734-assert in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 5538375b136557b3d445848685a8c19c3ee7b2be Author: Masayuki Ishikawa <[email protected]> AuthorDate: Thu Feb 22 10:32:37 2024 +0900 Revert "assert: change the do-while of assert to a conditional expression" This reverts commit 23aba6c2a1edf98fc6f408bbc8da690e52c939f7. --- include/assert.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/assert.h b/include/assert.h index 89d550a600..45d6e4d323 100644 --- a/include/assert.h +++ b/include/assert.h @@ -77,10 +77,20 @@ __ASSERT_LINE__, msg, regs) #define __ASSERT__(f, file, line, _f) \ - (predict_false(!(f))) ? __assert(file, line, _f) : ((void)0) + do \ + { \ + if (predict_false(!(f))) \ + __assert(file, line, _f); \ + } \ + while (0) #define __VERIFY__(f, file, line, _f) \ - (predict_false((f) < 0)) ? __assert(file, line, _f) : ((void)0) + do \ + { \ + if (predict_false((f) < 0)) \ + __assert(file, line, _f); \ + } \ + while (0) #ifdef CONFIG_DEBUG_ASSERTIONS_EXPRESSION # define _ASSERT(f,file,line) __ASSERT__(f, file, line, #f)
