Skip to content

Commit 78bb1c9

Browse files
committed
fix(build): scope #235 compile-edge depfile to GCC; e2e 118 requires gcc
The awk filter strips GCC -fmodules' reversed make-rules; Clang's module (.pcm) depfile shape differs and applying the GCC-shaped filter there is untested. macOS CI (Clang) failed e2e 118 because the purview-rebuild depfile didn't behave. Gate posixDepfile to CompilerId::GCC — Clang/MSVC keep the pre-#235 behavior (no compile-edge depfile; header/purview rebuild tracking on Clang is a follow-up, same as 0.0.96 → not a regression). e2e 118 now declares `# requires: gcc` so it skips where GCC isn't the toolchain (macOS has no gcc capability per run_all.sh). Linux GCC: depfile active, 117/118 green.
1 parent 24fb8d4 commit 78bb1c9

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎src/build/ninja_backend.cppm‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,19 @@ std::string emit_ninja_string(const BuildPlan& plan) {
456456
// below), so a non-MSVC Windows toolchain keeps the pre-#235
457457
// behavior (no depfile) rather than depend on an unavailable filter —
458458
// msvcDeps (cl.exe) is unaffected either way (deps=msvc, no -MMD).
459-
const bool posixDepfile = !msvcDeps && !mcpp::platform::is_windows;
459+
//
460+
// GCC-only: the awk filter strips the "reversed" make-rules that GCC's
461+
// `-fmodules -MMD` bolts onto a module-TU depfile (`gcm.cache/<m>.gcm: |
462+
// <obj>` etc., which ninja rejects as "inputs may not also have inputs").
463+
// Clang's module system (.pcm) does not emit those and its module-TU
464+
// depfile shape is different; applying the GCC-shaped filter there is
465+
// untested and could yield a wrong dep set. Until Clang is verified,
466+
// scope this to GCC — Clang keeps the pre-#235 behavior (no compile-edge
467+
// depfile; header/purview rebuild tracking on Clang is a follow-up, same
468+
// as it was on 0.0.96, so this is not a regression). e2e 118 declares
469+
// `# requires: gcc` and skips where GCC is not the toolchain.
470+
const bool posixDepfile = !msvcDeps && !mcpp::platform::is_windows
471+
&& plan.toolchain.compiler == mcpp::toolchain::CompilerId::GCC;
460472
const std::string mmd_flag = posixDepfile ? "-MMD -MF $out.d.raw " : "";
461473
const std::string mmd_filter = posixDepfile
462474
? " && awk 'NR==1{print;next} /^[^ ]/{exit} {print}' "

‎tests/e2e/118_purview_include_rebuild.sh‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env bash
2-
# requires:
2+
# requires: gcc
33
# mcpp#235: compile edges must track header/purview/GMF `#include`s via a
4+
# GCC-only depfile (the awk filter strips GCC -fmodules' reversed rules;
5+
# Clang/MSVC keep pre-#235 behavior — see ninja_backend posixDepfile gate).
46
# depfile. Before this fix, `cxx_module`/`cxx_object` had NO depfile on
57
# non-MSVC (only the msvcDeps branch added `deps=msvc`) — the P1689 scan's
68
# `$out.dep` was generated then discarded. So editing a file `#include`d

0 commit comments

Comments
 (0)