Restore ASSERT/VERIFY semantics

This partly fixes esp32-devkitc:knsh.
This commit is contained in:
YAMAMOTO Takashi 2024-09-06 12:23:00 +09:00 committed by Xiang Xiao
parent 43d0d95f81
commit 92a2e22c6c
1 changed files with 8 additions and 7 deletions

View File

@ -118,21 +118,22 @@
* *
* Reference link: * Reference link:
* https://pubs.opengroup.org/onlinepubs/009695399/basedefs/assert.h.html * https://pubs.opengroup.org/onlinepubs/009695399/basedefs/assert.h.html
*
* ASSERT/VERIFY is a non-standard interface, implemented using internal
*
*/ */
#ifdef NDEBUG #ifdef NDEBUG
# define assert(f) ((void)0) # define assert(f) ((void)0)
# define ASSERT(f) ((void)(1 || (f)))
# define VERIFY(f) ((void)(1 || (f)))
#else #else
# define assert(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__) # define assert(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__)
# define ASSERT(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__)
# define VERIFY(f) _VERIFY(f, __ASSERT_FILE__, __ASSERT_LINE__)
#endif #endif
/* ASSERT/VERIFY are NuttX-specific APIs.
* They are always enabled, regardless of NDEBUG/CONFIG_DEBUG_ASSERTIONS.
* The argument is evaluated exactly once.
*/
#define ASSERT(f) _ASSERT(f, __ASSERT_FILE__, __ASSERT_LINE__)
#define VERIFY(f) _VERIFY(f, __ASSERT_FILE__, __ASSERT_LINE__)
/* Suppress 3rd party library redefine _assert/__assert */ /* Suppress 3rd party library redefine _assert/__assert */
#define _assert _assert #define _assert _assert