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(...@@ -230,6 +230,7 @@ fn printType(
230 .int,230 .int,
231 .comptime_int,231 .comptime_int,
232 .float,232 .float,
233 .comptime_float,
233 .null,234 .null,
234 => {235 => {
235 if (name) |some| {236 if (name) |some| {
...@@ -594,6 +595,7 @@ test Options {...@@ -594,6 +595,7 @@ test Options {
594 options.addOption(?usize, "option2", null);595 options.addOption(?usize, "option2", null);
595 options.addOption(?usize, "option3", 3);596 options.addOption(?usize, "option3", 3);
596 options.addOption(comptime_int, "option4", 4);597 options.addOption(comptime_int, "option4", 4);
598 options.addOption(comptime_float, "option5", 5.01);
597 options.addOption([]const u8, "string", "zigisthebest");599 options.addOption([]const u8, "string", "zigisthebest");
598 options.addOption(?[]const u8, "optional_string", null);600 options.addOption(?[]const u8, "optional_string", null);
599 options.addOption([2][2]u16, "nested_array", nested_array);601 options.addOption([2][2]u16, "nested_array", nested_array);
...@@ -618,6 +620,7 @@ test Options {...@@ -618,6 +620,7 @@ test Options {
618 \\pub const option2: ?usize = null;620 \\pub const option2: ?usize = null;
619 \\pub const option3: ?usize = 3;621 \\pub const option3: ?usize = 3;
620 \\pub const option4: comptime_int = 4;622 \\pub const option4: comptime_int = 4;
623 \\pub const option5: comptime_float = 5.01;
621 \\pub const string: []const u8 = "zigisthebest";624 \\pub const string: []const u8 = "zigisthebest";
622 \\pub const optional_string: ?[]const u8 = null;625 \\pub const optional_string: ?[]const u8 = null;
623 \\pub const nested_array: [2][2]u16 = [2][2]u16 {626 \\pub const nested_array: [2][2]u16 = [2][2]u16 {