authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-26 09:50:48-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-26 09:50:48-07:00
logfd63f57cd86ebcf1261b10d1a17e62d523e70981
tree460fd0c0b77336e160a63cc969c8d40f9e9993d9
parent7228dc0ef98633876344c00fbadcef319dd11257

build system: update more usize to u64 for maxrss

makes the build system compile on 32 bit systems bonus, also fix incorrectly passing advanced debug options to the maker process which doesn't care about them

6 files changed, 16 insertions(+), 7 deletions(-)

lib/compiler/Maker.zig+2-2
......@@ -38,7 +38,7 @@ steps: []Step,
3838generated_files: []Path,
3939run_args: ?[]const []const u8,
4040
41available_rss: usize,
41available_rss: u64,
4242max_rss_is_default: bool,
4343max_rss_mutex: Io.Mutex,
4444skip_oom_steps: bool,
......@@ -740,7 +740,7 @@ fn prepare(maker: *Maker, step_names: []const []const u8) !void {
740740 {
741741 // Check that we have enough memory to complete the build.
742742 var any_problems = false;
743 var max_needed: usize = 0;
743 var max_needed: u64 = 0;
744744 for (step_stack.keys()) |step_index| {
745745 const make_step = maker.stepByIndex(step_index);
746746 const conf_step = step_index.ptr(c);
lib/compiler/Maker/Step/Run.zig+2-2
......@@ -1460,7 +1460,7 @@ fn evalGeneric(
14601460 stderr_bytes = try multi_reader.toOwnedSlice(1);
14611461 } else {
14621462 var stdout_reader = stdout.readerStreaming(io, &.{});
1463 const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited(x) else .unlimited;
1463 const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited64(x) else .unlimited;
14641464 stdout_bytes = stdout_reader.interface.allocRemaining(arena, stdio_limit) catch |err| switch (err) {
14651465 error.OutOfMemory => |e| return e,
14661466 error.ReadFailed => return stdout_reader.err.?,
......@@ -1469,7 +1469,7 @@ fn evalGeneric(
14691469 }
14701470 } else if (child.stderr) |stderr| {
14711471 var stderr_reader = stderr.readerStreaming(io, &.{});
1472 const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited(x) else .unlimited;
1472 const stdio_limit: Io.Limit = if (conf_run.stdio_limit.value) |x| .limited64(x) else .unlimited;
14731473 stderr_bytes = stderr_reader.interface.allocRemaining(arena, stdio_limit) catch |err| switch (err) {
14741474 error.OutOfMemory => |e| return e,
14751475 error.ReadFailed => return stderr_reader.err.?,
lib/compiler/configurer.zig+1-1
......@@ -1074,7 +1074,7 @@ fn serialize(b: *std.Build, wc: *Configuration.Wip, writer: *Io.Writer) !void {
10741074 } else null },
10751075 .environ_map = .{ .value = try s.addEnvironMap(run.environ_map) },
10761076 .expect_term_value = .{ .value = if (expect_term) |t| t.value else null },
1077 .stdio_limit = .{ .value = run.stdio_limit.toInt() },
1077 .stdio_limit = .{ .value = run.stdio_limit.toInt64() },
10781078 .producer = .{ .value = if (run.producer) |cs| s.stepIndex(&cs.step) else null },
10791079 .expect_stderr_exact = .{ .value = if (expect_stderr_exact) |bytes| bytes else null },
10801080 .expect_stdout_exact = .{ .value = if (expect_stdout_exact) |bytes| bytes else null },
lib/std/Build/Configuration.zig+2-2
......@@ -1458,12 +1458,12 @@ pub const MaxRss = enum(u32) {
14581458 none = 0,
14591459 _,
14601460
1461 pub fn toBytes(mr: MaxRss) usize {
1461 pub fn toBytes(mr: MaxRss) u64 {
14621462 const x: usize = @intFromEnum(mr);
14631463 return x << 8;
14641464 }
14651465
1466 pub fn fromBytes(bytes: usize) MaxRss {
1466 pub fn fromBytes(bytes: u64) MaxRss {
14671467 return @enumFromInt(bytes >> 8);
14681468 }
14691469};
lib/std/Io.zig+7
......@@ -689,6 +689,13 @@ pub const Limit = enum(usize) {
689689 };
690690 }
691691
692 pub fn toInt64(l: Limit) ?u64 {
693 return switch (l) {
694 else => @intFromEnum(l),
695 .unlimited => null,
696 };
697 }
698
692699 /// Reduces a slice to account for the limit, leaving room for one extra
693700 /// byte above the limit, allowing for the use case of differentiating
694701 /// between end-of-stream and reaching the limit.
src/main.zig+2
......@@ -5133,6 +5133,7 @@ fn cmdBuild(
51335133 } else {
51345134 warn("Zig was compiled without debug extensions. --debug-target has no effect.", .{});
51355135 }
5136 continue;
51365137 } else if (mem.eql(u8, arg, "--debug-libc")) {
51375138 if (i + 1 >= args.len) fatal("expected argument after '{s}'", .{arg});
51385139 i += 1;
......@@ -5141,6 +5142,7 @@ fn cmdBuild(
51415142 } else {
51425143 warn("Zig was compiled without debug extensions. --debug-libc has no effect.", .{});
51435144 }
5145 continue;
51445146 } else if (mem.eql(u8, arg, "--verbose-link")) {
51455147 verbose_link = true;
51465148 } else if (mem.eql(u8, arg, "--verbose-cc")) {