mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 20:54:32 +02:00
assert: extend likely macro to be called when silent assertions are off
This commit is contained in:
@@ -23,8 +23,19 @@
|
|||||||
|
|
||||||
#include_next <assert.h>
|
#include_next <assert.h>
|
||||||
|
|
||||||
|
|
||||||
#if defined(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG)
|
#if defined(CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT) && !defined(NDEBUG)
|
||||||
#undef assert
|
#undef assert
|
||||||
#define assert(__e) (likely(__e)) ? (void)0 : abort()
|
#define assert(__e) (likely(__e)) ? (void)0 : abort()
|
||||||
|
#else
|
||||||
|
/* moved part of toolchain provided assert to there then
|
||||||
|
* we can tweak the original assert macro to perform likely
|
||||||
|
* before deliver it to original toolchain implementation
|
||||||
|
*/
|
||||||
|
#undef assert
|
||||||
|
#ifdef NDEBUG
|
||||||
|
# define assert(__e) ((void)0)
|
||||||
|
#else
|
||||||
|
# define assert(__e) (likely(__e) ? (void)0 : __assert_func (__FILE__, __LINE__, \
|
||||||
|
__ASSERT_FUNC, #__e))
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user