From d678a63e0abf2ba8994225a9f0fd0047fee4025a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 14:37:21 -0300 Subject: Every catch unreachable, orelse unreachable and syscall assert outside tests is a real refusal or says why it cannot fire A sweep for round 23's crash: a run's answer (pty/run) was bufPrint'd into 48 bytes with catch unreachable, so a foreground program's long name (macOS gives up to 32 bytes) panicked; it now cuts at the room, keeping its newline, in 96 bytes. The rest were numbers into buffers sized for them, a braille codepoint, pthread calls on the queue's own mutex, and pdf_view's resolved outline entries: each now carries a one-line comment saying why it cannot fire. Co-Authored-By: Claude Opus 5.5 --- src/gui/gui.zig | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index e110b3ab..b34b314d 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -937,6 +937,8 @@ const Queue = struct { completion_len: usize = 0, fn lock(q: *Queue) void { + // unreachable failures: pthread calls on this queue's own initialised, non-recursive + // mutex and condition fail only on misuse (EINVAL, EDEADLK), never on input. std.debug.assert(libc.pthread_mutex_lock(&q.mutex) == .SUCCESS); } @@ -8334,6 +8336,7 @@ fn captureFrame(g: *Gui, gpa: std.mem.Allocator, cmd: *c.SDL_GPUCommandBuffer, t const pixels: [*]const u8 = @ptrCast(mapped); try writeCapturePpm(g, gpa, pixels[0..size], sw, sh, "latest"); var name: [24]u8 = undefined; + // unreachable below: "transition-" or "frame-" and a u32 fit 24 if (transition) |frame| try writeCapturePpm(g, gpa, pixels[0..size], sw, sh, std.fmt.bufPrint(&name, "transition-{d}", .{frame}) catch unreachable); if (g.capture_series) try writeCapturePpm(g, gpa, pixels[0..size], sw, sh, std.fmt.bufPrint(&name, "frame-{d:0>5}", .{g.captured}) catch unreachable); g.captured +%= 1; -- cgit v1.3