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:
Joakim Andersson 2019-12-20 16:12:14 +01:00 committed by Alberto Escolar
commit 000d9b15ff

View file

@ -32,6 +32,12 @@
#define __ASSERT_COND_INFO(test) Z_STRINGIFY(test)
#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
#if (__ASSERT_ON < 0) || (__ASSERT_ON > 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
#define __ASSERT_LOC(test) \
printk("ASSERTION FAIL [%s] @ %s:%d\n", \
__ASSERT_COND_INFO(test), \
__ASSERT_FILE_INFO, \
__LINE__) \
#define __ASSERT_NO_MSG(test) \
do { \
if (!(test)) { \