Skip to content

deduplicate_flags: keep paired flag+value tokens together#1168

Merged
crazywhalecc merged 1 commit into
v3from
v3c/deduplicate-flags-paired
May 24, 2026
Merged

deduplicate_flags: keep paired flag+value tokens together#1168
crazywhalecc merged 1 commit into
v3from
v3c/deduplicate-flags-paired

Conversation

@henderkes
Copy link
Copy Markdown
Collaborator

deduplicate_flags() split flags on whitespace then ran a per-token unique. For paired flags like -Xclang -mllvm or -framework Cocoa, where the value is a separate token, the value token could collide with an unrelated flag or value and get dropped, corrupting the command line.

Group known paired flags (-Xclang, -Xpreprocessor, -Xlinker, -Xassembler, -framework, -arch, -target, -include, -imacros, -isystem, -isysroot, -iquote, -idirafter, -MT, -MF, -MQ) with their following token into a single atom before the unique pass.

What does this PR do?

Checklist before merging

  • If you modified *.php or *.yml, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:lint-config

deduplicate_flags() split flags on whitespace then ran a per-token
unique. For paired flags like `-Xclang -mllvm` or `-framework Cocoa`,
where the value is a separate token, the value token could collide
with an unrelated flag or value and get dropped, corrupting the
command line.

Group known paired flags (-Xclang, -Xpreprocessor, -Xlinker,
-Xassembler, -framework, -arch, -target, -include, -imacros, -isystem,
-isysroot, -iquote, -idirafter, -MT, -MF, -MQ) with their following
token into a single atom before the unique pass.
@crazywhalecc crazywhalecc merged commit 6cab47d into v3 May 24, 2026
8 checks passed
@crazywhalecc crazywhalecc deleted the v3c/deduplicate-flags-paired branch May 24, 2026 14:57
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.

2 participants