Skip to content

Conversation

tristan-google
Copy link
Contributor

PR #94029 introduced a feature to filter out certain file paths from coverage dumps using the fnmatch function. Unfortauntely, this function is not universally implemented among all of Zephyr's libc options, particularly minimal libc. This causes build failures when libc support for fnmatch() is absent.

Update Kconfig with a depends on clause and a helper symbol that guards the fnmatch header and function call when not enabled.

PR zephyrproject-rtos#94029 introduced a feature to filter out certain file paths from
coverage dumps using the `fnmatch` function. Unfortauntely, this
function is not universally implemented among all of Zephyr's libc
options, particularly minimal libc. This causes build failures when libc
support for `fnmatch()` is absent.

Update Kconfig with a `depends on` clause and a helper symbol that
guards the fnmatch header and function call when not enabled.

Signed-off-by: Tristan Honscheid <[email protected]>
Copy link

sonarqubecloud bot commented Oct 7, 2025

config COVERAGE_DUMP_PATH_EXCLUDE
string "Exclude files matching this pattern from the coverage data"
default ""
depends on !MINIMAL_LIBC
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could use some assistance with finding the correct condition(s) to put here. MINIMAL_LIBC does not support it. I don't think newlib does either, but not certain. For an external libc, I don't know if there is any way to tell...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alternatively, we could not bother with checking which libc and leave it up to the developer to ensure fnmatch is provided if they require this new feature. The helper symbol HAVE_COVERAGE_DUMP_PATH_EXCLUDE causes the references to be guarded when the feature is not used (i.e. the path is an empty string), which limits the build error to just cases where a developer tries using COVERAGE_DUMP_PATH_EXCLUDE and does not have fnmatch().

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants