Refactor preprocessing arguments across toolchain configs#2530
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2530 +/- ##
=======================================
Coverage 65.35% 65.35%
=======================================
Files 147 147
Lines 26785 26785
Branches 16227 16227
=======================================
Hits 17506 17506
Misses 7074 7074
Partials 2205 2205
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Test Results 5 files 39 suites 3m 21s ⏱️ Results for commit d76669e. |
There was a problem hiding this comment.
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
-xclanguage selection out of sharedCPP_FLAGSand 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.
| set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} -xc ${CPP_DEFINES} ${CPP_INCLUDES} \"${LD_SCRIPT}\" -o \"${LD_SCRIPT_PP}\"") | ||
| separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT}) | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - > \"${COMPILE_MACROS}\"") | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - >") |
| set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} -xc ${CPP_DEFINES} ${CPP_INCLUDES} \"${LD_SCRIPT}\" -o \"${LD_SCRIPT_PP}\"") | ||
| separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT}) | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - > \"${COMPILE_MACROS}\"") | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - >") |
| set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} -xc ${CPP_DEFINES} ${CPP_INCLUDES} \"${LD_SCRIPT}\" -o \"${LD_SCRIPT_PP}\"") | ||
| separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT}) | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - > \"${COMPILE_MACROS}\"") | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - >") |
| set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} -xc ${CPP_DEFINES} ${CPP_INCLUDES} \"${LD_SCRIPT}\" -o \"${LD_SCRIPT_PP}\"") | ||
| separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT}) | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - > \"${COMPILE_MACROS}\"") | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - >") |
| set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} -xc ${CPP_DEFINES} ${CPP_INCLUDES} \"${LD_SCRIPT}\" -o \"${LD_SCRIPT_PP}\"") | ||
| separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT}) | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - > \"${COMPILE_MACROS}\"") | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - >") |
| set(CPP_ARGS_LD_SCRIPT "${CPP_FLAGS} -xc ${CPP_DEFINES} ${CPP_INCLUDES} \"${LD_SCRIPT}\" -o \"${LD_SCRIPT_PP}\"") | ||
| separate_arguments(CPP_ARGS_LD_SCRIPT NATIVE_COMMAND ${CPP_ARGS_LD_SCRIPT}) | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - > \"${COMPILE_MACROS}\"") | ||
| set(CPP_DUMP_MACROS "${CPP_FLAGS} -dM - >") |
Fixes
Aligns with Open-CMSIS-Pack/cbuild2cmake#503
Changes
-xclanguage option from the sharedCPP_FLAGSvariable into the linker script preprocessing command (CPP_ARGS_LD_SCRIPT).CPP_DUMP_MACROSin the AC6, Clang, TI Clang, GCC, XC, and IAR toolchain configurations, leaving only the compiler arguments.Checklist
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.