Generate language-specific compile macro files - #503
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🛟 Help
|
f98af1a to
f1da7be
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates generated context CMakeLists.txt files to produce language-specific preprocessor macro dumps (separate C vs C++) using the appropriate compiler “language mode” flags and language/common compiler options, addressing macro-dump correctness across toolchains.
Changes:
- Add generation logic for
CPP_OPTIONS_<LANG>plusCOMPILE_MACROS_C/COMPILE_MACROS_CXX, and emit macro-dumpadd_custom_command()accordingly. - Replace the previous single
compile_macros.houtput with language-scopedcompile_macros_c.handcompile_macros_cxx.hwhere applicable. - Update Go unit tests and a large set of reference CMake fixtures for supported toolchains / scenarios.
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| test/data/solutions/pre-include/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: switch to language-specific macro outputs and add CPP_OPTIONS_* for IAR. |
| test/data/solutions/pre-include/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: generate compile_macros_c.h with C-specific preprocessor options for GCC. |
| test/data/solutions/pre-include/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: generate compile_macros_c.h with C-specific preprocessor options for Clang. |
| test/data/solutions/pre-include/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: generate compile_macros_c.h with C-specific preprocessor options for AC6. |
| test/data/solutions/pre-include-oot/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture (OOT): switch to compile_macros_c.h and add IAR preprocessor options. |
| test/data/solutions/pre-include-oot/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture (OOT): switch to compile_macros_c.h and add GCC C options. |
| test/data/solutions/pre-include-oot/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture (OOT): switch to compile_macros_c.h and add Clang C options. |
| test/data/solutions/pre-include-oot/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture (OOT): switch to compile_macros_c.h and add AC6 C options. |
| test/data/solutions/linker-pre-processing/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: update macro dump output to compile_macros_c.h and add IAR options. |
| test/data/solutions/linker-pre-processing/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update macro dump output to compile_macros_c.h and add GCC C options. |
| test/data/solutions/linker-pre-processing/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: update macro dump output to compile_macros_c.h and add Clang C options. |
| test/data/solutions/linker-pre-processing/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: update macro dump output to compile_macros_c.h and add AC6 C options. |
| test/data/solutions/link-lib/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update GCC macro dump output to language-specific C macro file. |
| test/data/solutions/link-lib/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: update Clang macro dump output to language-specific C macro file. |
| test/data/solutions/library-rtos/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: update IAR macro dump output to language-specific C macro file with options. |
| test/data/solutions/library-rtos/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update GCC macro dump output to language-specific C macro file with options. |
| test/data/solutions/library-rtos/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: update Clang macro dump output to language-specific C macro file with options. |
| test/data/solutions/library-rtos/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: update AC6 macro dump output to language-specific C macro file with options. |
| test/data/solutions/language-scope/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: emit both C and CXX macro dumps and per-language options for IAR. |
| test/data/solutions/language-scope/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: emit both C and CXX macro dumps and per-language options for GCC. |
| test/data/solutions/language-scope/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: emit both C and CXX macro dumps and per-language options for Clang. |
| test/data/solutions/language-scope/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: emit both C and CXX macro dumps and per-language options for AC6. |
| test/data/solutions/include-define/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: update IAR macro dump output to language-specific C macro file with options. |
| test/data/solutions/include-define/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update GCC macro dump output to language-specific C macro file with options. |
| test/data/solutions/include-define/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: update Clang macro dump output to language-specific C macro file with options. |
| test/data/solutions/include-define/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: update AC6 macro dump output to language-specific C macro file with options. |
| test/data/solutions/executes/ref/project.Release+ARMCM0/CMakeLists.txt | Reference fixture: update Release macro dump output to compile_macros_c.h with options. |
| test/data/solutions/build-cpp/ref/project.IAR+ARMCM55/CMakeLists.txt | Reference fixture: emit both C/CXX macro dumps for IAR C++ build scenario. |
| test/data/solutions/build-cpp/ref/project.GCC+ARMCM55/CMakeLists.txt | Reference fixture: emit both C/CXX macro dumps for GCC C++ build scenario. |
| test/data/solutions/build-cpp/ref/project.CLANG+ARMCM55/CMakeLists.txt | Reference fixture: emit both C/CXX macro dumps for Clang C++ build scenario. |
| test/data/solutions/build-cpp/ref/project.AC6+ARMCM55/CMakeLists.txt | Reference fixture: emit both C/CXX macro dumps for AC6 C++ build scenario. |
| test/data/solutions/build-c/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: update IAR C-only macro dump output to compile_macros_c.h with options. |
| test/data/solutions/build-c/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update GCC C-only macro dump output to compile_macros_c.h with options. |
| test/data/solutions/build-c/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: update Clang C-only macro dump output to compile_macros_c.h with options. |
| test/data/solutions/build-c/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: update AC6 C-only macro dump output to compile_macros_c.h with options. |
| test/data/solutions/build-asm/ref/project.IAR+ARMCM0/CMakeLists.txt | Reference fixture: update IAR macro dump output to language-specific C macro file in ASM+C scenario. |
| test/data/solutions/build-asm/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update GCC macro dump output to language-specific C macro file in ASM+C scenario. |
| test/data/solutions/build-asm/ref/project.CLANG+ARMCM0/CMakeLists.txt | Reference fixture: update Clang macro dump output to language-specific C macro file in ASM+C scenario. |
| test/data/solutions/build-asm/ref/project.AC6+ARMCM0/CMakeLists.txt | Reference fixture: update AC6 macro dump output to language-specific C macro file in ASM+C scenario. |
| test/data/solutions/blanks/ref/project X.AC6 X+ARMCM0 X/CMakeLists.txt | Reference fixture: update macro dump output to language-specific C macro file with spaced paths scenario. |
| test/data/solutions/abstractions/ref/project.GCC+ARMCM0/CMakeLists.txt | Reference fixture: update GCC macro dump output to language-specific C macro file with options. |
| pkg/maker/contextlists.go | Implement generation of language-specific preprocessor options + macro dump outputs/commands. |
| pkg/maker/contextlists_test.go | Add unit tests for PreprocessorOptions() output (generic + IAR cases). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8f84492 to
318e971
Compare
|
@grasci-arm Review this change |
|
Plan: Development plan for PR #503:
Reply with a comment mentioning the service account and an approval phrase such as |

Fixes
Depends on Open-CMSIS-Pack/devtools#2530
Changes
-xcor-xc++, or--c++in case of IAR, plus language-specific and common compiler options to macro dump commands.compile_macros_c.handcompile_macros_cxx.hfiles for enabled C and C++ languages has several advantages over a single-file approach:Risk / limitations
compile_macros.houtput is replaced by language-specific files, which may affect consumers relying on that filename.Checklist