Drop build-noise flags AND the operand that follows standalone path flags. Without consuming the operand, tokens like ``header.h`` (after ``-include``) or ``foo.o`` (after ``-o``) survive normalization and masquerade as drift signal. This loop is the single normalization site that b
(flags: list[str])
| 251 | |
| 252 | |
| 253 | def _clean_flags(flags: list[str]) -> set[str]: |
| 254 | """Drop build-noise flags AND the operand that follows standalone path flags. |
| 255 | |
| 256 | Without consuming the operand, tokens like ``header.h`` (after |
| 257 | ``-include``) or ``foo.o`` (after ``-o``) survive normalization and |
| 258 | masquerade as drift signal. This loop is the single normalization site |
| 259 | that both ``cc_flags`` and ``cxx_flags`` flow through. |
| 260 | """ |
| 261 | cleaned: set[str] = set() |
| 262 | skip_next = False |
| 263 | for flag in flags: |
| 264 | if skip_next: |
| 265 | skip_next = False |
| 266 | continue |
| 267 | if flag in _STANDALONE_PATH_FLAGS or flag in _FLAGS_WITH_VALUE: |
| 268 | # The argv token after one of these is a path operand. Drop it. |
| 269 | skip_next = True |
| 270 | continue |
| 271 | if _should_ignore_flag(flag): |
| 272 | continue |
| 273 | cleaned.add(_normalize_flag(flag)) |
| 274 | return cleaned |
| 275 | |
| 276 | |
| 277 | def normalize_build_info(raw: dict, board: str, backend: str) -> NormalizedFlags: |
no test coverage detected