Commit Graph

3 Commits

Author SHA1 Message Date
Drew T 3e6c364cd8 feat(phase-29): T73 — items 1+2: ARITY class resolved, audit learns §113; DECLS is the last value
ITEM 1 (call-vs-address re-check). My first detector counted the DECLARATIONS as calls, so every
function looked "called". Stripping `extern ...;` first gives the real split: func_80144B14 is
ADDRESS-TAKEN only (full retype — done in T72, 137/137); func_8013BD34 / func_8014358C /
func_8017D808 are genuinely CALLED and need §99.

§99 applied to all three -> R22 clean-fleet 140 passed, 0 failed of 140, byte-neutral.

SWEEP YIELD: ZERO, and recorded as such. func_8013BD34's family swept 0/136 — exactly as predicted
when I switched T72's probe off it (its def lives in ov_SC07_010_o0.c and _o0 families sweep ~1/137).
func_8014358C has no family as exemplar; func_8017D808's family is 1 member with an unbanked
exemplar. The §99 fixes are correct and byte-neutral but unblock nothing today.

ITEM 2: called_in_headers() strips declarations, treats `fn(` as a call and `&fn` as not; arity_ok is
now "arity matches OR the macro never calls it" (§113). Verified against all four.

THE AUDIT AFTER BOTH — 28 findings (from 61):
  DECLS  9 fns  141 stubbed binaries   <- the only class with value left
  SAFE  13 fns   15
  ARITY  3 fns    0                    <- §99 cleared the stub-bearing ones
  §85    3 fns    0
func_80147364 is 137 of those 141, and is item 3.
2026-07-29 00:42:40 -06:00
Drew T a6e5abfd39 fix(phase-29): T69 — audit preconditions computed, not discovered; validated against known outcomes
Item 1. audit_header_sigs.py now COMPUTES the safe subset instead of leaving it to a failed gate,
and the two new preconditions took two wrong models to get right (cookbook §112).

PRECONDITION 1 — ARITY: correcting a `(void)` header decl for a 1-param definition breaks the macro's
OWN call site ("too few arguments"). Measured before the batch.

PRECONDITION 2 — VISIBLE COLLISION, and the two wrong models on the way:
  (a) "any disagreeing decl in src/ blocks it" — compares type SPELLINGS, so s32-vs-int and
      u32-vs-unsigned-int count as disagreements. Fixed by comparing type IDENTITY via
      cdecl.compatible. Finding count 61 -> 32 once that noise is gone.
  (b) "any INCOMPATIBLE decl in src/ blocks it" — STILL WRONG. It blocked ALL SIX corrections that
      had just gated 140/140 and banked 685 members. func_80161774 has 1,063 TUs carrying the old
      spelling and correcting it was byte-clean.
  The right model: a macro-body decl is only visible where the MACRO IS INSTANTIATED, so a collision
  needs a TU that BOTH instantiates the macro AND carries an incompatible decl. Measure the
  INTERSECTION, not the population (macro_owners() + per-TU macro-use set).

VALIDATED AGAINST KNOWN OUTCOMES (the control this needed): the six that gated clean -> 0 colliding
TUs each; the one that failed the gate (func_80147364) -> 272. Perfect discrimination.

HONEST RESULT: 32 findings, 13 SAFE — but the safe subset is worth only 15 stubbed binaries. The
high-value targets (func_80147364 at 137, the arity trio at ~410) are all BLOCKED and need
conform_decls or §99 first. The cheap header lever is spent.

No src/ or config/ change: no bank, no metric move.
2026-07-28 23:26:02 -06:00
Drew T 0c5df25faf feat(phase-29): T67 — audit_header_sigs.py; 61 header decls contradict byte truth, 6 corrected
THE TOOL (tools/audit_header_sigs.py, cookbook §112). A DEFINE_func_*() macro forward-declares the
functions its body calls, and that decl is visible in EVERY overlay instantiating the macro — so when
it disagrees with the byte-true definition the whole family becomes untemplatable and the failure
wears a compiler wall's clothes. Three such were found ONE AT A TIME earlier this phase
(func_80156044, func_8016163C, func_8014D610), each worth ~137 members, each costing a
diagnose/fix/re-sweep cycle. This audits all of them in one pass: parse every `extern func_X(...)` in
src/shared/*.h, find every DEFINITION in src/**/*.c (via §110's _def_head_at, not "ends in ;"),
compare with cdecl, and report only where NO definition agrees — one overlay disagreeing is loose
typing (§16/T49), all of them disagreeing means the header is the outlier.

RESULT: 3,043 decls across 1,023 functions; 265 have definitions; 61 contradict every one. The top 10
are full-fleet families (137/136/134 live stubs, 1,366 total), all with an unambiguous byte truth.

APPLIED: 6 functions / 11 decl sites, R22 clean-fleet 140 passed, 0 failed of 140 —
func_80138DE0, func_80146750, func_80161374, func_80161774, func_80161888, func_801778A8.

TWO PRECONDITIONS THE AUDIT DOES NOT YET CHECK, both found by gating rather than by reasoning:
 1. ARITY. func_80144B14 / func_8013BD34 / func_8014358C declare (void) but are DEFINED with one
    parameter. Correcting the header would break the macro's OWN call site (too few arguments), so
    they need the §99 no-prototype treatment instead. Excluded before the batch, by measurement.
 2. OTHER IN-SCOPE DECLS. The first batch of 7 FAILED the gate 2/140 with `conflicting types for
    func_80147364` — the overlays' own TUs declare it the old way (9 header sites rewritten, but
    src/ov_*/…:347 disagrees). A header correction is only safe when no other in-scope declaration
    disagrees; that one additionally needs a conform_decls pass. Excluded; the other 6 then gated
    140/140 clean.

The gate caught the bad batch immediately and the culprit was found by reading one object's real cc1
output rather than by a 7-way bisect (7 fleet gates = ~2.5h; one serial compile = seconds).
2026-07-28 23:00:55 -06:00