diff --git a/include/sys/__assert.h b/include/sys/__assert.h index b24f97ea709..6a89ec6639d 100644 --- a/include/sys/__assert.h +++ b/include/sys/__assert.h @@ -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)