assert: Move __ASSERT_LOC so it can be used when asserts are disabled
Move __ASSERT_LOC macro so that it can be used by other modules even when CONFIG_ASSERT are disabled. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
94d331b2eb
commit
000d9b15ff
1 changed files with 6 additions and 6 deletions
|
@ -32,6 +32,12 @@
|
||||||
#define __ASSERT_COND_INFO(test) Z_STRINGIFY(test)
|
#define __ASSERT_COND_INFO(test) Z_STRINGIFY(test)
|
||||||
#endif /* CONFIG_ASSERT_NO_COND_INFO */
|
#endif /* CONFIG_ASSERT_NO_COND_INFO */
|
||||||
|
|
||||||
|
#define __ASSERT_LOC(test) \
|
||||||
|
printk("ASSERTION FAIL [%s] @ %s:%d\n", \
|
||||||
|
__ASSERT_COND_INFO(test), \
|
||||||
|
__ASSERT_FILE_INFO, \
|
||||||
|
__LINE__) \
|
||||||
|
|
||||||
#ifdef __ASSERT_ON
|
#ifdef __ASSERT_ON
|
||||||
#if (__ASSERT_ON < 0) || (__ASSERT_ON > 2)
|
#if (__ASSERT_ON < 0) || (__ASSERT_ON > 2)
|
||||||
#error "Invalid __ASSERT() level: must be between 0 and 2"
|
#error "Invalid __ASSERT() level: must be between 0 and 2"
|
||||||
|
@ -51,12 +57,6 @@ void assert_post_action(const char *file, unsigned int line);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define __ASSERT_LOC(test) \
|
|
||||||
printk("ASSERTION FAIL [%s] @ %s:%d\n", \
|
|
||||||
__ASSERT_COND_INFO(test), \
|
|
||||||
__ASSERT_FILE_INFO, \
|
|
||||||
__LINE__) \
|
|
||||||
|
|
||||||
#define __ASSERT_NO_MSG(test) \
|
#define __ASSERT_NO_MSG(test) \
|
||||||
do { \
|
do { \
|
||||||
if (!(test)) { \
|
if (!(test)) { \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue