Repository navigation
fix(driver): accept an empty --cflags value - #62
Merged
Merged
Conversation
An omitted --cflags and --cflags= were the same empty string, so a compilation database with no -D flags failed. An empty value is now a real configuration, and --settings-h is still applied.
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the change distinguishing explicit empty CFLAGS from an omitted configuration.
No open issues 🎉
What changed in this PR
This PR lets the SBOM driver distinguish an explicit empty --cflags= from an omitted configuration, supporting compilation databases that contain no -D flags.
Changes:
- Accept empty
--cflags=while preserving the requirement to select a configuration mode. - Apply
--settings-hduring an empty CFLAGS capture. - Add regression tests for driver behavior and compilation-database forwarding.
| File | Description |
|---|---|
tests/test_sbom.py |
Tests omitted and empty CFLAGS, including settings-header capture. |
tests/test_compdb_sbom.py |
Tests forwarding --cflags= when no defines are present. |
share/sbom-driver.py |
Distinguishes empty from omitted CFLAGS and updates help text. |
Review effort: Balanced
Frauschi
reviewed
Nov 27, 2026
Frauschi
left a comment
Member
There was a problem hiding this comment.
The driver change works; the main ask is a warning so an empty capture from a forgotten CMake config doesn't pass silently.
An empty flag list with no settings header now warns, and sbom.mk sends --cflags= in that case so it matches CMake.
Frauschi
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--cflagsnow defaults to an omitted value, so an explicit--cflags=is a configuration with no-Dtokens.--settings-his still applied for that empty capture. Omitting--cflagsstill requires another config mode.-Dflags forwards--cflags=and the driver accepts it.Test plan
python3 tests/test_sbom.py(unit and integration)python3 tests/test_compdb_sbom.py