Skip to content

refactor(cmake): ♻️ query machine flags from ARCH_FLAG itself - #304

Open
robertodr wants to merge 3 commits into
mainfrom
split/03-arch-flags
Open

refactor(cmake): ♻️ query machine flags from ARCH_FLAG itself#304
robertodr wants to merge 3 commits into
mainfrom
split/03-arch-flags

Conversation

@robertodr

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Summary

Independent of the rest of the #226 split; branches off main and touches one CMake file.

_monoprop_query_machine_flags took a MARCH <arch> argument and a "default" sentinel meaning "whatever the compiler already targets". That asks the option what the machine flags are, when the thing that actually decides them is the flag the compiler ends up emitting. The helper now takes ARCH_FLAGS <flags...> directly and reports what those flags yield, so a caller passes what it is really compiling with instead of a name that stands in for it.

No change to the flags any build produces. Configured with monoprop_ENABLE_ARCH_FLAGS both ON and OFF against the old and new helper: monoprop_DEFAULT_VARIANT_FLAGS, monoprop_VARIANTS, monoprop_VARIANT_FLAGS and ARCH_FLAG come out identical in all four combinations.

Changes

  • cmake/compiler_flags/CXXFlags.cmake: _monoprop_query_machine_flags(ARCH_FLAGS <flags...> OUTPUT_VARIABLE <var>) replaces the MARCH <arch> form and its "default" sentinel; call sites updated.

Checklist

  • Tests added or updated to cover the changes
  • Documentation updated (docstrings, docs/, CONTRIBUTING.md) if needed
  • CHANGELOG / release notes updated if applicable

Build-system change with no test surface; verified by comparing the derived variables across configures.

AI/LLM disclosure

  • I used the following tool to help write this PR description: ClaudeCode (claude-opus-5)
  • I used the following tool to generate or modify code: ClaudeCode (claude-opus-5)

_monoprop_query_machine_flags took a -march *name* plus a "default" sentinel and
rebuilt the flag from it, which meant the query could only ever ask about the
one architecture selection the function knew how to spell. It now takes the
ARCH_FLAGS list the build actually passes, so what is queried is what is
compiled, and an empty list is the no-arch-flag build rather than a special case.

Inert by construction and checked as such: configured with
monoprop_ENABLE_ARCH_FLAGS both ON and OFF, monoprop_DEFAULT_VARIANT_FLAGS,
monoprop_VARIANTS, monoprop_VARIANT_FLAGS and ARCH_FLAG all come out identical
to the previous implementation.

Assisted-by: ClaudeCode:claude-opus-5
@github-actions

Copy link
Copy Markdown

Docs preview: https://pr-304.monoprop-docs.pages.dev

@robertodr
robertodr enabled auto-merge (squash) August 29, 2026 14:35
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@665508e). Learn more about missing BASE report.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #304   +/-   ##
=======================================
  Coverage        ?   97.70%           
=======================================
  Files           ?       14           
  Lines           ?      742           
  Branches        ?       98           
=======================================
  Hits            ?      725           
  Misses          ?       12           
  Partials        ?        5           
Flag Coverage Δ
cpp 97.70% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant