authorgravatar for iokg04@gmail.comIOKG04 <iokg04@gmail.com> 2025-10-18 14:58:22+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2025-11-26 09:57:49+01:00
loge23af9d31d79af3636cea5bfb8fc4c9b26f1c854
treeb2722eb80546b8cb74fb82512c0f6c2725acaaa4
parentf3270ceca42e02a8d17fff9bee8c7fc4d4f8ea65

`Build.Step.Options`: add `comptime_float` support

It seems to me this was simply forgotten. Or there is some reason I don't know why this code doesn't work for `comptime_float`. For a more comprehensive fix, https://github.com/ziglang/zig/pull/24057 is the place to look.

1 files changed, 3 insertions(+), 0 deletions(-)

lib/std/Build/Step/Options.zig+3
......@@ -230,6 +230,7 @@ fn printType(
230230 .int,
231231 .comptime_int,
232232 .float,
233 .comptime_float,
233234 .null,
234235 => {
235236 if (name) |some| {
......@@ -594,6 +595,7 @@ test Options {
594595 options.addOption(?usize, "option2", null);
595596 options.addOption(?usize, "option3", 3);
596597 options.addOption(comptime_int, "option4", 4);
598 options.addOption(comptime_float, "option5", 5.01);
597599 options.addOption([]const u8, "string", "zigisthebest");
598600 options.addOption(?[]const u8, "optional_string", null);
599601 options.addOption([2][2]u16, "nested_array", nested_array);
......@@ -618,6 +620,7 @@ test Options {
618620 \\pub const option2: ?usize = null;
619621 \\pub const option3: ?usize = 3;
620622 \\pub const option4: comptime_int = 4;
623 \\pub const option5: comptime_float = 5.01;
621624 \\pub const string: []const u8 = "zigisthebest";
622625 \\pub const optional_string: ?[]const u8 = null;
623626 \\pub const nested_array: [2][2]u16 = [2][2]u16 {