Skip to content

Refactor preprocessing arguments across toolchain configs#2530

Merged
brondani merged 3 commits into
mainfrom
refactor-linker-script-preprocessing
Jul 21, 2026
Merged

Refactor preprocessing arguments across toolchain configs#2530
brondani merged 3 commits into
mainfrom
refactor-linker-script-preprocessing

Conversation

@brondani

@brondani brondani commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Fixes

Aligns with Open-CMSIS-Pack/cbuild2cmake#503

Changes

  • Refactor preprocessing command construction in the AC6, Clang, TI Clang, GCC, and XC toolchain CMake configurations by moving the -xc language option from the shared CPP_FLAGS variable into the linker script preprocessing command (CPP_ARGS_LD_SCRIPT).
  • Simplify predefined macro dump command definitions by removing the output file redirection/path from CPP_DUMP_MACROS in the AC6, Clang, TI Clang, GCC, XC, and IAR toolchain configurations, leaving only the compiler arguments.
  • Language-specific and common compiler options to macro dump commands will be handled in generated CMakeLists.

Checklist

  • 🤖 This change is covered by unit tests (if applicable).
  • 🤹 Manual testing has been performed (if necessary).
  • 🛡️ Security impacts have been considered (if relevant).
  • 📖 Documentation updates are complete (if required).
  • 🧠 Third-party dependencies and TPIP updated (if required).

Risk / Follow-up

These changes affect how preprocessing commands are assembled for multiple supported toolchains. The primary risk is regressions in linker script preprocessing or predefined macro generation, so validating build generation across the affected toolchains is recommended.

@brondani brondani changed the title Refactor linker script preprocessing arguments across toolchain configs Refactor preprocessing arguments across toolchain configs Jul 20, 2026
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

Test Results

  5 files   39 suites   3m 8s ⏱️
185 tests 168 ✅ 17 💤 0 ❌
509 runs  458 ✅ 51 💤 0 ❌

Results for commit 00a9696.

♻️ This comment has been updated with latest results.

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.

Pull request overview

Refactors how C preprocessor-related command fragments are defined in the toolchain CMake config templates, aiming to centralize/standardize linker-script preprocessing and predefined-macro dump command construction across multiple toolchains (in line with related upstream work).

Changes:

  • Moves the -xc language selection out of shared CPP_FLAGS and into the linker-script preprocessing invocation (CPP_ARGS_LD_SCRIPT) for AC6, Clang, TI Clang, GCC, and XC.
  • Simplifies predefined-macro dump command fragments (CPP_DUMP_MACROS) by removing the output path handling from toolchain configs (IAR uses --predef_macros; others previously used > redirection).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
tools/buildmgr/cbuildgen/config/XC.5.0.0.cmake Adjusts XC32 preprocessor flags and macro-dump command fragment.
tools/buildmgr/cbuildgen/config/IAR.9.32.1.cmake Simplifies IAR macro-dump command fragment by removing the output filename.
tools/buildmgr/cbuildgen/config/GCC.10.3.1.cmake Moves -xc to linker-script preprocessing args; updates macro-dump fragment.
tools/buildmgr/cbuildgen/config/CLANG.17.0.1.cmake Moves -xc to linker-script preprocessing args; updates macro-dump fragment.
tools/buildmgr/cbuildgen/config/CLANG_TI.4.0.1.cmake Moves -xc to linker-script preprocessing args; updates macro-dump fragment.
tools/buildmgr/cbuildgen/config/AC6.6.16.2.cmake Moves -xc to linker-script preprocessing args; updates macro-dump fragment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/buildmgr/cbuildgen/config/AC6.6.16.2.cmake Outdated
Comment thread tools/buildmgr/cbuildgen/config/CLANG.17.0.1.cmake Outdated
Comment thread tools/buildmgr/cbuildgen/config/CLANG_TI.4.0.1.cmake Outdated
Comment thread tools/buildmgr/cbuildgen/config/GCC.10.3.1.cmake Outdated
Comment thread tools/buildmgr/cbuildgen/config/XC.5.0.0.cmake Outdated
Comment thread tools/buildmgr/cbuildgen/config/GCC.10.3.1.cmake Outdated
@brondani
brondani marked this pull request as ready for review July 21, 2026 09:27
@brondani
brondani requested a review from soumeh01 July 21, 2026 09:28
@codecov

codecov Bot commented Jul 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.33%. Comparing base (b4297d8) to head (00a9696).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2530      +/-   ##
==========================================
- Coverage   65.36%   65.33%   -0.03%     
==========================================
  Files         147      147              
  Lines       26800    26768      -32     
  Branches    16236    16214      -22     
==========================================
- Hits        17517    17489      -28     
+ Misses       7076     7074       -2     
+ Partials     2207     2205       -2     
Flag Coverage Δ
buildmgr-cov 79.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.
see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@soumeh01 soumeh01 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.

LGTM

@brondani
brondani merged commit 633c10f into main Jul 21, 2026
29 checks passed
@brondani
brondani deleted the refactor-linker-script-preprocessing branch July 21, 2026 12:39
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