Commit Graph

2 Commits

Author SHA1 Message Date
c3f994822d lib/fmt+lib/log+lib/memio: drop rt_syscall stubs in tests; use os
After 12436dd, lib/fmt and lib/log production code routed through
os.write / os.exit. The test files (fmttest, logtest, memiotest)
still carried the same @symbol("rt_syscall") syscall1ww / doexit
stub block with the (now stale) os↔io collision rationale. Same
mechanical drop as 12436dd: add use os;, route fail() through
os.exit, remove the stubs.

Also reword the stale workaround comment in lib/memio/memio.ww
covering rt_alloc/rt_free. The decls themselves stay until lib/os
exports alloc/free as a follow-up.

No combined.ww regen (these files aren't bootstrap-folded).
2026-05-16 00:03:19 +09:00
e7f173cde0 lib+test: add log over io.stream sink
Hare-shaped lib/log v1: logger vtable carrying one println slot,
stdlogger forwarding to a *io.stream, plus *logger globals (silent
/ default / global), setlogger, lprintln / println, lfatal / fatal.
Default sink is stderr through a private rt_syscall write callback;
graduates with #17 (cgen mod-mangle for fn labels), at which point
the rt_syscall stub disappears the same way fmt's will.

Module-scope struct/pointer-literal init isn't constexpr in cstage
emit_lets, so silent/default/global are wired lazily by ensureinit
on the first exported-fn entry (lib/temp rnginit pattern). Callers
that read the globals directly must call some lib/log fn first.

Skipped this round: printfln / lprintfln / fatalf / lfatalf and the
matching printfln vtable slot — they need a fmt {n}-placeholder
parser that isn't shipped yet. fatal / lfatal's exit(255) arm has
no test fixture (needs fork+wait for WEXITSTATUS); left as TODO.

971_log_run wraps the @test fixture under `ww run`, mirroring
970_fmt_run. make test: 54/54; bootstrap fixed-point (990-997)
holds.
2026-05-15 14:05:55 +09:00