diff --git a/phase-ends/current/logs/T5.c2.md b/phase-ends/current/logs/T5.c2.md new file mode 100644 index 0000000000..d1f27ebb82 --- /dev/null +++ b/phase-ends/current/logs/T5.c2.md @@ -0,0 +1,33 @@ +# T5.c2 — canon hygiene: pad_names, dead, variants + +Result: census `dup_classes=198 outside_canon=3680 dead=134 variants=0 pad_names=0 parse_error_decls=1106 controls=4/4` (run t5c2census2, HEAD 6f01332bc). Was pad_names=72, dead=447, variants=40, dup_classes=205. +Residual dead 134 = `.run/P38/t5/c2_residual.txt` (namecause); census dead set == residual set (checked). + +## Commits +- bc9c5bebb pad_names 72->0: 72 `pad` fields in engine_types.h -> `pad_` (all 72 violations were in engine_types.h). Accesses: only `msg.pad1/pad2` (Msg_8018248C* family) in 5 TUs -> `msg.pad_A/pad_E`. commit_task.sh also staged the pending `logs/T5.c1.md` (script stages logs/). +- 81fc2be28 dead: 313 canon defs deleted from engine_types.h (fixed-point: all names dead, no reference from remaining canon text, comments stripped). Preceding whole-line comments kept. +- e5ba08739 variants 40->0: 543 divergent defs renamed, 2124 token replacements in 404 files. +- 6f01332bc Vec_td (new dead after the split, unused) deleted. + +## How (scratch scripts, .run/P38/t5/, not committed) +- pad_fix.py: restruct.audit_type_violations() -> rename token inside the def's walker span (refuses if token count != 1 in span). +- dead_fix.py: census dead list minus (a) single-char names, (b) names with a real (comment-stripped) `git grep -w` use outside canon. Census blind spots found: type_census.py:603 ident filter drops len<2 names and `D_`/`func_`-prefixed names; macro bodies are masked. First attempt deleted `W` etc. -> R22 17 FAIL (ov_SC01_077 `W' undeclared`); reverted, guarded, re-run green. +- var_list.py: walk_all (cache) + census's layout block -> every def of each variant name with lhash (.run/P38/t5/variants.json). +- var_fix.py: keep = canon layout; canon tag+typedef of one spelling (Entry, M8, Obj, Quad, S, S8, SV3_8012CC88, Vec, W4) -> keep the more-used one, rename the other `_tag`/`_td`; no canon -> most defs, tie -> header file-scope def, else first (file,line). Scope-aware token rename: namespace tag (`struct|union N`) vs ordinary; skips `.N`/`->N`, comments, strings; each token resolved to innermost local def region (block def -> enclosing block end via sc.mask_text brace walk; .c file-scope -> whole file) else 800_shared.h def for its includers, else canon. Suffix: `_[_][_]`, shared headers `__`, uniqueness checked with `git grep -ohwF` over src/include/tools. +- First variant apply failed main (800_b_2.c `conflicting types for func_800314DC`): a pre-def `struct Obj` forward ref was resolved to canon; fix = .c file-scope region starts at line 1. Restored and re-applied; green. + +## Verified +- R22 `make clean && make extract-all JOBS=16 && make check-all JOBS=16`: after pads (t5c2r22a), dead (t5c2r22c), variants (t5c2r22e), Vec_td (t5c2r22f) each `217 extracted, 0 failed of 217` + `218 passed, 0 failed of 218`, rc 0. +- census --check-structs t5c2census2: line above; exit 1 only for dup_classes/outside_canon/dead/parse_error_decls (not this task's metrics except dead residual). + +## Residual dead 134 (causes) +- 114 referenced by live canon defs (member types, e.g. Vtx_8017DC24 in Prim_8017DC24) or by a live alias typedef (Rec801806C8_s, Rec80182744_s). Census counts only uses outside canon, so a member-only type is "dead" by metric; deleting would break the referencer. +- 12 used outside canon in forms the census filters (D_ prefix, macro bodies): D_80195D74_Entry, D_801D0630_s, D_801D0660_s, D_801EC450_t, D_87298, LineF2_8018F694, PTag_80180B3C/801833F0/8018478C/80188C04/8018B028/8018BED0. +- 6 single-char A B P S V W: ident filter len>1 hides uses (W deletion broke the build). +- 1 actor4c: self-referencing tag (`struct actor4c *unk20`). +- 1 Unkstruct_80126B58: include/struct_types.h generated head_types block (T3); not hand-edited (§6). + +## For the expert +- generalizable: type_census dead metric is blind to len<2, D_/func_-prefixed and macro-body uses; any deletion must re-check with `git grep -w` on comment-stripped text. +- generalizable: C tag and typedef namespaces share one census name; a canon `struct N` + `typedef … N` pair counts as a variant. +- dup_classes moved 205 -> 198 as a side effect.