authorgravatar for kcbanner@gmail.comCasey Banner <kcbanner@gmail.com> 2025-09-06 01:13:34-04:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-09-12 02:32:06+02:00
logcbe1b4571b1fab519b2b4bb95fd7507c7b7626b0
treea58cbe5f42f9ea20a13295cb2622a1a6a4c62ee8
parent52eb9e84fb5b06581cff626051d1f09be3de8eb8
signaturebadge-check Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

webui: fixup build errors in fuzz / time_report


2 files changed, 20 insertions(+), 19 deletions(-)

lib/build-web/fuzz.zig+6-6
...@@ -101,22 +101,22 @@ const SourceLocationIndex = enum(u32) {...@@ -101,22 +101,22 @@ const SourceLocationIndex = enum(u32) {
101101
102 fn sourceLocationLinkHtml(102 fn sourceLocationLinkHtml(
103 sli: SourceLocationIndex,103 sli: SourceLocationIndex,
104 out: *std.ArrayListUnmanaged(u8),104 out: *std.ArrayList(u8),
105 focused: bool,105 focused: bool,
106 ) Allocator.Error!void {106 ) error{OutOfMemory}!void {
107 const sl = sli.ptr();107 const sl = sli.ptr();
108 try out.writer(gpa).print("<code{s}>", .{108 try out.print(gpa, "<code{s}>", .{
109 @as([]const u8, if (focused) " class=\"status-running\"" else ""),109 @as([]const u8, if (focused) " class=\"status-running\"" else ""),
110 });110 });
111 try sli.appendPath(out);111 try sli.appendPath(out);
112 try out.writer(gpa).print(":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{112 try out.print(gpa, ":{d}:{d} </code><button class=\"linkish\" onclick=\"wasm_exports.fuzzSelectSli({d});\">View</button>", .{
113 sl.line,113 sl.line,
114 sl.column,114 sl.column,
115 @intFromEnum(sli),115 @intFromEnum(sli),
116 });116 });
117 }117 }
118118
119 fn appendPath(sli: SourceLocationIndex, out: *std.ArrayListUnmanaged(u8)) Allocator.Error!void {119 fn appendPath(sli: SourceLocationIndex, out: *std.ArrayList(u8)) error{OutOfMemory}!void {
120 const sl = sli.ptr();120 const sl = sli.ptr();
121 const file = coverage.fileAt(sl.file);121 const file = coverage.fileAt(sl.file);
122 const file_name = coverage.stringAt(file.basename);122 const file_name = coverage.stringAt(file.basename);
...@@ -294,7 +294,7 @@ fn updateStats() error{OutOfMemory}!void {...@@ -294,7 +294,7 @@ fn updateStats() error{OutOfMemory}!void {
294}294}
295295
296fn updateEntryPoints() error{OutOfMemory}!void {296fn updateEntryPoints() error{OutOfMemory}!void {
297 var html: std.ArrayListUnmanaged(u8) = .empty;297 var html: std.ArrayList(u8) = .empty;
298 defer html.deinit(gpa);298 defer html.deinit(gpa);
299 for (entry_points.items) |sli| {299 for (entry_points.items) |sli| {
300 try html.appendSlice(gpa, "<li>");300 try html.appendSlice(gpa, "<li>");
lib/build-web/time_report.zig+14-13
...@@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {...@@ -44,7 +44,7 @@ pub fn genericResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
44 js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len);44 js.updateGeneric(msg.step_idx, inner_html.ptr, inner_html.len);
45}45}
4646
47pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {47pub fn compileResultMessage(msg_bytes: []u8) error{ OutOfMemory, WriteFailed }!void {
48 const max_table_rows = 500;48 const max_table_rows = 500;
4949
50 if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message");50 if (msg_bytes.len < @sizeOf(abi.CompileResult)) @panic("malformed CompileResult message");
...@@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {...@@ -166,10 +166,11 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
166 });166 });
167 defer gpa.free(inner_html);167 defer gpa.free(inner_html);
168168
169 var file_table_html: std.ArrayListUnmanaged(u8) = .empty;169 var file_table_html: std.Io.Writer.Allocating = .init(gpa);
170 defer file_table_html.deinit(gpa);170 defer file_table_html.deinit();
171
171 for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| {172 for (slowest_files[0..@min(max_table_rows, slowest_files.len)]) |file| {
172 try file_table_html.writer(gpa).print(173 try file_table_html.writer.print(
173 \\<tr>174 \\<tr>
174 \\ <th scope="row"><code>{f}</code></th>175 \\ <th scope="row"><code>{f}</code></th>
175 \\ <td>{D}</td>176 \\ <td>{D}</td>
...@@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {...@@ -187,17 +188,17 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
187 });188 });
188 }189 }
189 if (slowest_files.len > max_table_rows) {190 if (slowest_files.len > max_table_rows) {
190 try file_table_html.writer(gpa).print(191 try file_table_html.writer.print(
191 \\<tr><td colspan="4">{d} more rows omitted</td></tr>192 \\<tr><td colspan="4">{d} more rows omitted</td></tr>
192 \\193 \\
193 , .{slowest_files.len - max_table_rows});194 , .{slowest_files.len - max_table_rows});
194 }195 }
195196
196 var decl_table_html: std.ArrayListUnmanaged(u8) = .empty;197 var decl_table_html: std.Io.Writer.Allocating = .init(gpa);
197 defer decl_table_html.deinit(gpa);198 defer decl_table_html.deinit();
198199
199 for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| {200 for (slowest_decls[0..@min(max_table_rows, slowest_decls.len)]) |decl| {
200 try decl_table_html.writer(gpa).print(201 try decl_table_html.writer.print(
201 \\<tr>202 \\<tr>
202 \\ <th scope="row"><code>{f}</code></th>203 \\ <th scope="row"><code>{f}</code></th>
203 \\ <th scope="row"><code>{f}</code></th>204 \\ <th scope="row"><code>{f}</code></th>
...@@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {...@@ -219,7 +220,7 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
219 });220 });
220 }221 }
221 if (slowest_decls.len > max_table_rows) {222 if (slowest_decls.len > max_table_rows) {
222 try decl_table_html.writer(gpa).print(223 try decl_table_html.writer.print(
223 \\<tr><td colspan="6">{d} more rows omitted</td></tr>224 \\<tr><td colspan="6">{d} more rows omitted</td></tr>
224 \\225 \\
225 , .{slowest_decls.len - max_table_rows});226 , .{slowest_decls.len - max_table_rows});
...@@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {...@@ -229,10 +230,10 @@ pub fn compileResultMessage(msg_bytes: []u8) error{OutOfMemory}!void {
229 hdr.step_idx,230 hdr.step_idx,
230 inner_html.ptr,231 inner_html.ptr,
231 inner_html.len,232 inner_html.len,
232 file_table_html.items.ptr,233 file_table_html.written().ptr,
233 file_table_html.items.len,234 file_table_html.written().len,
234 decl_table_html.items.ptr,235 decl_table_html.written().ptr,
235 decl_table_html.items.len,236 decl_table_html.written().len,
236 hdr.flags.use_llvm,237 hdr.flags.use_llvm,
237 );238 );
238}239}