Skip to content

fix(driver): accept an empty --cflags value - #62

Merged
Frauschi merged 2 commits into
masterfrom
fix/empty-cflags
Nov 27, 2026
Merged

Frauschi merged 2 commits into
masterfrom
fix/empty-cflags

Conversation

@sameehj

@sameehj sameehj commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • --cflags now defaults to an omitted value, so an explicit --cflags= is a configuration with no -D tokens.
  • --settings-h is still applied for that empty capture. Omitting --cflags still requires another config mode.
  • A compilation database with no -D flags forwards --cflags= and the driver accepts it.

Test plan

  • python3 tests/test_sbom.py (unit and integration)
  • python3 tests/test_compdb_sbom.py

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.
Copilot AI balanced review requested due to automatic review settings November 27, 2026 06:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 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-h during 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

@sameehj
sameehj requested a review from Frauschi November 27, 2026 09:00

@Frauschi Frauschi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The driver change works; the main ask is a warning so an empty capture from a forgotten CMake config doesn't pass silently.

Comment thread share/sbom-driver.py Resolved
Comment thread tests/test_sbom.py Resolved
Comment thread share/sbom-driver.py Resolved
Comment thread tests/test_sbom.py Resolved
Comment thread tests/test_sbom.py Resolved
An empty flag list with no settings header now warns, and sbom.mk sends --cflags= in that case so it matches CMake.
@Frauschi
Frauschi merged commit 292d4ea into master Nov 27, 2026
5 checks passed
@Frauschi
Frauschi deleted the fix/empty-cflags branch November 27, 2026 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants