lib: banner purge + WHY-only comment sweep (rule 8)

Every // ---- section banner dies (132 -> 0): names carry the WHAT.
Narration deleted (filename restatements, run-with lines, what-the-
next-line-does); every ref/hare cite, task cite, divergence, ABI/
layout contract, and ownership qualifier kept (borrowed-view lines
restored where the sweep over-cut). Comment-only proven: all 442
walk-workdir .s and 32 import-probe .s byte-identical before/after;
libbyteid 56-roster all-ID.
This commit is contained in:
2026-08-08 21:10:18 +09:00
parent 659e859f34
commit aadc6618f0
90 changed files with 259 additions and 919 deletions

View File

@@ -403,8 +403,6 @@ export fn strerror(err: *error) str = {
return r;
};
// ---- help output --------------------------------------------------------
//
// ref/hare/getopt/getopts.ha:202-335.
//
// Divergences from Hare (all forced):
@@ -447,13 +445,11 @@ fn _printusage(
) (size | io.error) = {
let z: size = 0;
// "Usage: <name>"
match (fmt.fprint(out, "Usage:", name)) {
case let n: size => z += n;
case let e: io.error => return e;
};
// Optional auto-[-h] + flag cluster [-Xabc].
let startedflags: bool = false;
if (!hascmdh) {
match (fmt.fprint(out, " [-h")) {
@@ -485,7 +481,6 @@ fn _printusage(
};
};
// Parameter slots [-X <name>].
i = 0;
for (i < help.len) {
let p: *help = &help[i];
@@ -571,7 +566,6 @@ export fn printhelp(
return void;
};
// Print "name: summary\n\n" if help[0] is a CMD entry.
let p0: *help = &help[0];
if (p0.kind == helpkind.CMD) {
match (fmt.fprintfln(out, "{}: {}\n", name, p0.text)) {
@@ -593,13 +587,11 @@ export fn printhelp(
case let e: io.error => return e;
};
// Blank line between usage and option list.
match (fmt.fprint(out, "\n")) {
case let n: size => {};
case let e: io.error => return e;
};
// Auto -h line if not declared.
if (!hascmdh) {
match (fmt.fprintln(out, "-h: print this help text")) {
case let n: size => {};
@@ -607,7 +599,6 @@ export fn printhelp(
};
};
// Per-option lines.
let i: i32 = 0;
for (i < help.len) {
let p: *help = &help[i];

View File

@@ -1,6 +1,3 @@
// getopttest — exercises lib/getopt. Run with
// `out/bin/ww run lib/getopt/getopttest.ww`.
//
// Every @test enumerates parallel `[N]T` arrays of inputs and
// expectations, then iterates one body across them. Parallel arrays
// (rather than `[N]struct{...}`) sidestep the cstage cgen's chained
@@ -36,8 +33,6 @@ fn streq(a: str, b: str) bool = {
return true;
};
// ---- flagcluster: -Fahs files.txt → 4 flags + 1 arg --------------------
@test fn flagcluster() void = {
let helps: [5]getopt.help;
getopt.cmdhelp(&helps[0], "list files");
@@ -82,8 +77,6 @@ fn streq(a: str, b: str) bool = {
getopt.finish(&cmd);
};
// ---- paramflag: glued + separated arguments ----------------------------
@test fn paramflag() void = {
let helps: [3]getopt.help;
getopt.cmdhelp(&helps[0], "edit");
@@ -125,8 +118,6 @@ fn streq(a: str, b: str) bool = {
getopt.finish(&cmd);
};
// ---- separator: -- ends option processing ------------------------------
//
// `--` in three positions: after a flag, immediately after argv[0],
// and at the tail with nothing trailing. Flat-packed argv per
// errortable's pattern; rows expect distinct (optslen, argslen,
@@ -176,8 +167,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- repeatedflag: -vvv → 3 v opts -------------------------------------
@test fn repeatedflag() void = {
let helps: [2]getopt.help;
getopt.cmdhelp(&helps[0], "verbose count");
@@ -207,8 +196,6 @@ fn streq(a: str, b: str) bool = {
getopt.finish(&cmd);
};
// ---- baredash: "-" alone is a positional --------------------------------
//
// Bare `-` in three positions: trailing after a flag, leading (which
// halts option scanning), and followed by what looks like a flag
// (also halts — first non-flag wins).
@@ -257,8 +244,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- errortable: unknownopt + requiresarg variants ---------------------
//
// Parallel arrays per row: argv flat-packed into `srcs`, with `argo`
// the offset and `argn` the count for each row.
@test fn errortable() void = {
@@ -306,8 +291,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- strerrortext: render both error kinds -----------------------------
//
// Parallel rows over (kind, flag, name) → expected message. `kind`
// rides as i32 because the errorkind enum doesn't yet index an
// array element directly.
@@ -332,8 +315,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- nooptionsbare: argv with only program name + positionals ----------
//
// Positional-only argv at three lengths: two positionals, one
// positional, and the program-name-only edge.
@test fn nooptionsbare() void = {
@@ -380,8 +361,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- printusage_cases: table of width-measure paths --------------------
//
// ref/hare/getopt/getopts.ha:202-265.
// Row 0: short line (≤72) — auto-[-h] + FLAG cluster, no wrap.
// Row 1: long line (>72) — PARAM slots each prefixed with \n\t.
@@ -434,8 +413,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- optionsizepin: option is 32B, not 24B -----------------------------
//
// tryparse/finish free the parsed-option array at `cap * size(option)`.
// option = rune (4) + pad (4) + str (24, #1/Phase 3) = 32B. A hardcoded
// `24u64` here was an 8-byte-per-element under-free; pinning the size
@@ -445,8 +422,6 @@ fn streq(a: str, b: str) bool = {
assert(!(size(getopt.option) != 32));
};
// ---- freeroundtrip: parse → finish over {0, 1, several} options --------
//
// Exercises the free path at three distinct cap values so the
// `cap * size(option)` free in [[finish]] runs for an empty, single,
// and multi-element option array. The under-free is not directly
@@ -493,8 +468,6 @@ fn streq(a: str, b: str) bool = {
};
};
// ---- printhelp_cases: table of help-output paths ----------------------
//
// ref/hare/getopt/getopts.ha:281-314.
// Row 0: empty help slice → early return, no output.
// Row 1: full help (CMD+FLAG+PARAM+CMD) → summary + usage + option list.