Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: os: cbprinf prevent circular includes #36883

Conversation

nordic-krch
Copy link
Contributor

When printk is redirected to logging (CONFIG_LOG_PRINTK) then printk.h includes log_msg2.h which includes cbprintf_internal.h which includes __assert.h which includes printk.h.

Fixing it by adding compile time switches for including and using asserts in cbprintf and forcing to not use them when LOG_PRINTK is set.

Fixes #36486.

@zephyrbot zephyrbot added the area: Base OS Base OS Library (lib/os) label Jul 12, 2021
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>
Prevent CONFIG_CBPRINTF_STATIC_PACKAGE_CHECK_ALIGNMENT when LOG_PRINTK.
Prevent use of assert in cbprintf header when printk is redirected
to logging. Enabling it would lead to circular header includes and
compilation failure.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
@nordic-krch nordic-krch force-pushed the fix/cbprintf_self_referential_macro branch from a1dad3f to 3ff7247 Compare July 13, 2021 04:51
@cfriedt cfriedt merged commit 69d2cc4 into zephyrproject-rtos:main Jul 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: API Changes to public APIs area: Base OS Base OS Library (lib/os)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

LOG2 - self referential macro
6 participants