selfhost/, cmd/, internal/ join the tree-wide sweep: every section banner dies (91 selfhost + the cmd C-style dividers -> 0); narration and stale contracts deleted (pre-#22 bundler notes, retired single-PT_LOAD and no-archive claims, superseded ABI tables); every ref/harec/qbe cite, task cite, encoding/ELF contract, and rule-10 twin pointer kept; lost lifetime/rationale lines restored where the sweep over-cut (elf_globals ownership, kwtab linear-scan). Comment- only proven: all five wwstage tool binaries byte-identical across the sweep; test-commit, test-byteid (161+1399, 0 pinned-divergent), and test-bootstrap (fixed point + 991-995 byte-id) all exit 0. The read-through banked 66 latent-bug leads (checkpoint).
39 lines
791 B
Plaintext
39 lines
791 B
Plaintext
// Port of cmd/wcc/err.c. Plan 9 style: short, no levels beyond
|
|
// fatal/error/warn. Output goes through os.write so we don't pull in
|
|
// libc stdio.
|
|
|
|
package wcc;
|
|
|
|
import os;
|
|
import fmt;
|
|
|
|
type pos = struct {
|
|
file: str,
|
|
line: i32,
|
|
col: i32,
|
|
};
|
|
|
|
let nerrors: i32 = 0;
|
|
let nwarnings: i32 = 0;
|
|
|
|
export fn fatal(msg: str) void = {
|
|
fmt.errorln(msg);
|
|
os.exit(1);
|
|
};
|
|
|
|
export fn errorf(p: pos, msg: str) void = {
|
|
os.write(2, p.file.ptr, p.file.len: u64);
|
|
os.write(2, ": error: ".ptr, 9u64);
|
|
os.write(2, msg.ptr, msg.len: u64);
|
|
os.write(2, "\n".ptr, 1u64);
|
|
nerrors += 1;
|
|
};
|
|
|
|
export fn warnf(p: pos, msg: str) void = {
|
|
os.write(2, p.file.ptr, p.file.len: u64);
|
|
os.write(2, ": warning: ".ptr, 11u64);
|
|
os.write(2, msg.ptr, msg.len: u64);
|
|
os.write(2, "\n".ptr, 1u64);
|
|
nwarnings += 1;
|
|
};
|