Repository navigation
Commit 960f0b2
committed
prepare.cppm: split into the primary interface and thirteen implementation files
The physical split (design step 4-5 combined, given the time this
decomposition has already taken): src/build/prepare.cppm keeps only
the module preamble, the exported helper functions (with bodies --
splitting each into a bare declaration plus a definition in a separate
exports.cpp was not done; at 2414 lines the file is under the 2500
hard cap without it, so this was deferred rather than risk a
mechanical error for no required outcome), and prepare_build's own
exported declaration with its default arguments. Everything else moved
under src/build/prepare/:
state.cppm implementation partition :state -- PrepareState,
the five structs P4 needed hoisted, and every
phase function's declaration.
driver.cpp prepare_build's definition.
manifest.cpp P0.
toolchain.cpp P1 + P2.
toolchain_decision.cpp P5 (split out of toolchain.cpp: P1+P2+P5
together were 2526 lines, over the hard cap).
xlings.cpp P3.
graph_load.cpp P4a (loadVersionDep).
graph.cpp P4b (the worklist engine).
features.cpp P6-P8.
target_side.cpp P9.
scan.cpp P11.
plan.cpp P13.
Two visibility problems, both from the same cause -- an implementation
partition does not implicitly see its module's primary interface the
way an implementation unit does, so it must import it explicitly:
- The preamble helpers moved out of their anonymous namespace in the
previous commit for exactly this reason, but ToolPurpose (a type,
not a module-linkage function) still needed an explicit `export`:
:state names it in PrepareState's own member list, and a partition
only sees what its imports export.
- state.cppm added `import mcpp.build.prepare;` for BuildOverrides,
BuildContext, PlanNote, CacheMode and TcOrigin, all exported types
PrepareState's declaration itself names.
Every other file compiled against the split on the first attempt: the
extensive state.<name> threading done in every prior commit was
already correct, this just gave it its own files.
All twelve source files are at or under the 2500-line hard cap; nine
are at or under the 2000-line target. prepare.cppm (2414) and three
implementation files (target_side.cpp 1968, features.cpp 2052,
toolchain.cpp 2136, graph.cpp 2345, plan.cpp 2392) sit between the two
because splitting them further was not required to satisfy the cap
and each remaining cut point would have needed its own escaping-
closure audit.
GCC 16.1 builds this cleanly: the primary interface imports no
partition, :state is an implementation partition imported only by
implementation units, satisfying the constraint verified in
.agents/docs/2026-09-27-mcpp-2026.9.27.1-ecosystem-plan.md §4.3.
Golden fixture diff against the baseline is empty; mcpp test:
129/129 (root) plus every member with tests (versioning, platform,
manifest, toolchain-model, buildmcpp) individually green.1 parent a65a52c commit 960f0b2
13 files changed
Lines changed: 15257 additions & 14030 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
0 commit comments