Skip to content

tests: timer_api: logging/log_syst: fix unused var warnings when CONFIG_ZTEST_ASSERT_VERBOSE is 0 #90701

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dcpleung
Copy link
Member

@dcpleung dcpleung commented May 27, 2025

When CONFIG_ZTEST_ASSERT_VERBOSE is 0, some zassert_*() functions do not use all of the inputs, resulting in compiler complaining about unused variables. So mark them __used.

@dcpleung dcpleung force-pushed the tests/unused_vars branch from 32623a6 to e83459d Compare May 27, 2025 22:57
dcpleung added 2 commits May 27, 2025 16:14
When CONFIG_ZTEST_ASSERT_VERBOSE is 0, the array round_s is not
being used by zassert_true(). So mark it __maybe_unused to
avoid compiler warnings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
When CONFIG_ZTEST_ASSERT_VERBOS is 0, syst_headers_name[] is
not exactly being used by zassert_mem_equal(). Mark it as
__maybe_unused to avoid compiler warnings.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
@dcpleung dcpleung force-pushed the tests/unused_vars branch from e83459d to a3909ec Compare May 27, 2025 23:15
@dcpleung dcpleung changed the title tests: timer_api: logging/log_syst: fix unused var warnings when CONFIG_ZTEST_ASSERT_VERBOSE is disabled tests: timer_api: logging/log_syst: fix unused var warnings when CONFIG_ZTEST_ASSERT_VERBOSE is 0 May 27, 2025
@dcpleung dcpleung marked this pull request as ready for review May 27, 2025 23:26
Copy link

Copy link
Collaborator

@nordic-krch nordic-krch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we finally change assert macros to logging style where arguments are always evaluated by the compiler? if (IS_ENABLED(CONFIG_ASSERT)) instead of #ifdef CONFIG_ASSERT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants