This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 3b6e7c1927e0eeb47f57b34de6f3056d4d11087b
Author: yinshengkai <[email protected]>
AuthorDate: Tue Feb 20 20:05:14 2024 +0800

    assert: When defining NDEBUG, do not use macro parameters
    
    The implementation of assert in linux is as follows:
    define assert(expr)        (__ASSERT_VOID_CAST (0))
    
    After defining NDEBUG in sqlite, some variables will be undefined,
    and referencing variables in assert will cause compilation errors.
    
    sqlite3.c:28729:23: error: ‘mutexIsInit’ undeclared (first use in this 
function)
    28729 |   assert( GLOBAL(int, mutexIsInit) );
    
    Signed-off-by: yinshengkai <[email protected]>
---
 include/assert.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/assert.h b/include/assert.h
index 89d550a600..be3ec5c588 100644
--- a/include/assert.h
+++ b/include/assert.h
@@ -96,7 +96,7 @@
 #  define DEBUGVERIFY(f) _VERIFY(f, __DEBUG_ASSERT_FILE__, 
__DEBUG_ASSERT_LINE__)
 #else
 #  define DEBUGPANIC()
-#  define DEBUGASSERT(f) ((void)(1 || (f)))
+#  define DEBUGASSERT(f) ((void)(0))
 #  define DEBUGVERIFY(f) ((void)(f))
 #endif
 
@@ -106,7 +106,7 @@
  */
 
 #ifdef NDEBUG
-#  define assert(f) ((void)(1 || (f)))
+#  define assert(f) ((void)(0))
 #  define VERIFY(f) assert(f)
 #else
 #  define assert(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__)

Reply via email to