Skip to content

Commit

Permalink
Restore ASSERT/VERIFY semantics
Browse files Browse the repository at this point in the history
This partly fixes esp32-devkitc:knsh.
  • Loading branch information
yamt authored and xiaoxiang781216 committed Sep 9, 2024
1 parent 43d0d95 commit 92a2e22
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions include/assert.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,21 +118,22 @@
*
* Reference link:
* https://pubs.opengroup.org/onlinepubs/009695399/basedefs/assert.h.html
*
* ASSERT/VERIFY is a non-standard interface, implemented using internal
*
*/

#ifdef NDEBUG
# define assert(f) ((void)0)
# define ASSERT(f) ((void)(1 || (f)))
# define VERIFY(f) ((void)(1 || (f)))
#else
# 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

/* 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 */

#define _assert _assert
Expand Down

0 comments on commit 92a2e22

Please sign in to comment.