lib: os: cbprintf: Add compile time switch for assert usage
Assert header is including printk header and cbprintf header may be included by printk.h when printk is redirected to logging v2. That creates circular includes which must be prevented by preventing using assertion and including assert header file. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
This commit is contained in:
parent
ac85886070
commit
4e3e013050
1 changed files with 6 additions and 4 deletions
|
@ -13,7 +13,10 @@
|
|||
#include <stdint.h>
|
||||
#include <toolchain.h>
|
||||
#include <sys/util.h>
|
||||
|
||||
#ifdef CONFIG_CBPRINTF_STATIC_PACKAGE_CHECK_ALIGNMENT
|
||||
#include <sys/__assert.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Special alignment cases
|
||||
|
@ -336,10 +339,9 @@ do { \
|
|||
"Xtensa requires aligned package."); \
|
||||
BUILD_ASSERT((_align_offset % sizeof(int)) == 0, \
|
||||
"Alignment offset must be multiply of a word."); \
|
||||
if (IS_ENABLED(CONFIG_CBPRINTF_STATIC_PACKAGE_CHECK_ALIGNMENT)) { \
|
||||
__ASSERT(!((uintptr_t)buf & (CBPRINTF_PACKAGE_ALIGNMENT - 1)), \
|
||||
"Buffer must be aligned."); \
|
||||
} \
|
||||
IF_ENABLED(CONFIG_CBPRINTF_STATIC_PACKAGE_CHECK_ALIGNMENT, \
|
||||
(__ASSERT(!((uintptr_t)buf & (CBPRINTF_PACKAGE_ALIGNMENT - 1)), \
|
||||
"Buffer must be aligned.");)) \
|
||||
uint8_t *_pbuf = buf; \
|
||||
size_t _pmax = (buf != NULL) ? _inlen : INT32_MAX; \
|
||||
int _pkg_len = 0; \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue