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 <yinshengkai@xiaomi.com>
This commit is contained in:
parent
23aba6c2a1
commit
3b6e7c1927
@ -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__)
|
||||
|
Loading…
x
Reference in New Issue
Block a user