commit 25e9d22807dca495bb4bc66391d09a2431fb796f (tree)
parent f37d0bdff7e1a19ec913e6fba70234fadbc4c584
Author: Mason Remaley <mason@gamesbymason.com>
Date: Thu, 28 May 2026 14:10:25 -0700
Fixes the optimization mode passed to translate C
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/lib/compiler/Maker/Step/TranslateC.zig b/lib/compiler/Maker/Step/TranslateC.zig
@@ -5,6 +5,7 @@ const Io = std.Io;
const Configuration = std.Build.Configuration;
const allocPrint = std.fmt.allocPrint;
const assert = std.debug.assert;
+const OptimizeMode = std.lang.OptimizeMode;
const Step = @import("../Step.zig");
const Maker = @import("../../Maker.zig");
@@ -47,10 +48,13 @@ pub fn make(
}
}
- switch (conf_tc.flags.optimize) {
- .debug, .default => {}, // Skip since it's the default.
- else => argv.appendAssumeCapacity(try allocPrint(arena, "-O{t}", .{conf_tc.flags.optimize})),
- }
+ const opt: ?OptimizeMode = switch (conf_tc.flags.optimize) {
+ .debug, .default => null, // Skip since it's the default
+ .safe => .ReleaseSafe,
+ .fast => .ReleaseFast,
+ .small => .ReleaseSmall,
+ };
+ if (opt) |o| argv.appendAssumeCapacity(try allocPrint(arena, "-O{t}", .{o}));
try argv.ensureUnusedCapacity(arena, conf_tc.include_dirs.len * 2);
for (0..conf_tc.include_dirs.len) |i|