Forward target options during detection - #2825
Conversation
Preserve target selection, including response-file arguments, when running the compiler identification preprocessor probe. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes C/C++ compiler vendor detection for Clang-compatible cross-compilers by forwarding target-selection flags into the preprocessing probe used during detection (including when those flags come from @response files). This prevents detection failures when a compiler requires an explicit target to run even in -E mode.
Changes:
- Forward
--targetand-target(including joined/separated spellings) into the compiler detection probe. - Expand
@responsefiles during detection argument scanning so target flags provided via response files are preserved. - Add unit tests covering forwarding and normalization behavior for
--target/-target, including response-file input.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2825 +/- ##
==========================================
- Coverage 73.71% 70.11% -3.61%
==========================================
Files 72 72
Lines 37932 37966 +34
==========================================
- Hits 27963 26620 -1343
- Misses 9969 11346 +1377 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Compiler identification runs a preprocessing probe without preserving target selection. Clang-compatible cross-compilers that require an explicit target can therefore fail detection before a compilation is considered for caching.
Forward GNU/Clang
--targetand-targetoptions into the detection probe, including values supplied through response files. Normalize single-dash-targetto the separated form accepted by standard Clang and add coverage for all joined and separated forms.This change was primarily made to fix an assumed regression in v0.17 where informing SCcache that
ARM-ClangwasClang-likewas now failingGitHub copilot was used for the debugging and resolution of this issue.