assert: Disable line number printing together with file printing
Disable printing the line number in assertions when file name has been disabled. Knowing the line number is not very useful when the name of the file is unknown. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
4af5815bf4
commit
8aecf14928
1 changed files with 7 additions and 3 deletions
|
@ -28,8 +28,10 @@
|
|||
|
||||
#ifdef CONFIG_ASSERT_NO_FILE_INFO
|
||||
#define __ASSERT_FILE_INFO ""
|
||||
#define __ASSERT_LINE_INFO 0
|
||||
#else /* CONFIG_ASSERT_NO_FILE_INFO */
|
||||
#define __ASSERT_FILE_INFO __FILE__
|
||||
#define __ASSERT_LINE_INFO __LINE__
|
||||
#endif /* CONFIG_ASSERT_NO_FILE_INFO */
|
||||
|
||||
#ifdef CONFIG_ASSERT_NO_COND_INFO
|
||||
|
@ -48,7 +50,7 @@
|
|||
__ASSERT_PRINT("ASSERTION FAIL [%s] @ %s:%d\n", \
|
||||
__ASSERT_COND_INFO(test), \
|
||||
__ASSERT_FILE_INFO, \
|
||||
__LINE__) \
|
||||
__ASSERT_LINE_INFO) \
|
||||
|
||||
#ifdef __ASSERT_ON
|
||||
#if (__ASSERT_ON < 0) || (__ASSERT_ON > 2)
|
||||
|
@ -73,7 +75,8 @@ void assert_post_action(const char *file, unsigned int line);
|
|||
do { \
|
||||
if (!(test)) { \
|
||||
__ASSERT_LOC(test); \
|
||||
assert_post_action(__ASSERT_FILE_INFO, __LINE__); \
|
||||
assert_post_action(__ASSERT_FILE_INFO, \
|
||||
__ASSERT_LINE_INFO); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
@ -82,7 +85,8 @@ void assert_post_action(const char *file, unsigned int line);
|
|||
if (!(test)) { \
|
||||
__ASSERT_LOC(test); \
|
||||
__ASSERT_MSG_INFO(fmt, ##__VA_ARGS__); \
|
||||
assert_post_action(__ASSERT_FILE_INFO, __LINE__); \
|
||||
assert_post_action(__ASSERT_FILE_INFO, \
|
||||
__ASSERT_LINE_INFO); \
|
||||
} \
|
||||
} while (false)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue