wcc: delete unused warning counters and ww err twin
This commit is contained in:
@@ -40,8 +40,7 @@ type checker = struct {
|
||||
// diagnostics. Tool-local (NOT a lib wrapper): messages are built from
|
||||
// many fragments and we route through os.write to avoid libc stdio.
|
||||
// .len replaces the error-prone hand-counted byte literals these sites
|
||||
// carried. Lives here (not err.ww) because the selfhost build pulls
|
||||
// check.ww but not err.ww (which ports err.c for the C-driven path).
|
||||
// carried.
|
||||
fn cerr(m: str) void = {
|
||||
os.write(2, m.ptr, m.len: u64);
|
||||
};
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
// 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;
|
||||
};
|
||||
Reference in New Issue
Block a user