authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-03-13 14:14:01-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-25 18:54:34-07:00
logc60d33f167494afea808dc0ac9c476422efe22c0
tree9d95ed93f03cc46ea4da9bdfb276f2dbf9314ee5
parent6ad6a58e5dcb2d127f980cfb9d3edd7cf1964852

Configuration: refactor maxInt(u32)


2 files changed, 14 insertions(+), 15 deletions(-)

BRANCH_TODO-1
......@@ -1,4 +1,3 @@
1* maxInt(u32) -> max_u32
21* replace b.dupe() with string internment
32* don't forget to add -listen arg back
43* get zig init template working
lib/std/Build/Configuration.zig+14-14
......@@ -4,7 +4,7 @@ const std = @import("../std.zig");
44const Io = std.Io;
55const Allocator = std.mem.Allocator;
66const assert = std.debug.assert;
7const maxInt = std.math.maxInt;
7const max_u32 = std.math.maxInt(u32);
88
99string_bytes: []u8,
1010steps: []Step,
......@@ -1094,7 +1094,7 @@ pub const LazyPath = union(@This().Tag) {
10941094
10951095 /// An index into `extra`, or `null`.
10961096 pub const OptionalIndex = enum(u32) {
1097 none = maxInt(u32),
1097 none = max_u32,
10981098 _,
10991099
11001100 pub fn unwrap(this: @This()) ?Index {
......@@ -1149,7 +1149,7 @@ pub const GeneratedFileIndex = enum(u32) {
11491149};
11501150
11511151pub const OptionalGeneratedFileIndex = enum(u32) {
1152 none = maxInt(u32),
1152 none = max_u32,
11531153 _,
11541154
11551155 pub fn init(i: ?GeneratedFileIndex) OptionalGeneratedFileIndex {
......@@ -1169,7 +1169,7 @@ pub const Package = struct {
11691169 hash: String,
11701170
11711171 pub const Index = enum(u32) {
1172 root = maxInt(u32),
1172 root = max_u32,
11731173 _,
11741174
11751175 /// Returns `null` for root package.
......@@ -1352,7 +1352,7 @@ pub const ImportTable = struct {
13521352
13531353 /// Points into `extra`.
13541354 pub const Index = enum(u32) {
1355 invalid = maxInt(u32),
1355 invalid = max_u32,
13561356 _,
13571357
13581358 pub fn get(this: @This(), c: *const Configuration) ImportTable {
......@@ -1385,7 +1385,7 @@ pub const Deps = struct {
13851385///
13861386/// Stored identically to `Deps`.
13871387pub const OptionalStringList = enum(u32) {
1388 none = maxInt(u32),
1388 none = max_u32,
13891389 _,
13901390
13911391 pub fn slice(osl: OptionalStringList, c: *const Configuration) ?[]const String {
......@@ -1414,11 +1414,11 @@ pub const Path = extern struct {
14141414};
14151415
14161416pub const InstallDestDir = enum(u32) {
1417 none = maxInt(u32) - 4,
1418 prefix = maxInt(u32) - 3,
1419 lib = maxInt(u32) - 2,
1420 bin = maxInt(u32) - 1,
1421 header = maxInt(u32),
1417 none = max_u32 - 4,
1418 prefix = max_u32 - 3,
1419 lib = max_u32 - 2,
1420 bin = max_u32 - 1,
1421 header = max_u32,
14221422 /// A `String` path relative to the prefix.
14231423 _,
14241424
......@@ -1433,7 +1433,7 @@ pub const OptionalString = enum(u32) {
14331433 empty = 0,
14341434 /// The string "root".
14351435 root = 1,
1436 none = maxInt(u32),
1436 none = max_u32,
14371437 _,
14381438
14391439 pub fn init(s: String) OptionalString {
......@@ -1633,7 +1633,7 @@ pub const ResolvedTarget = struct {
16331633 };
16341634
16351635 pub const OptionalIndex = enum(u32) {
1636 none = maxInt(u32),
1636 none = max_u32,
16371637 _,
16381638
16391639 pub fn unwrap(this: @This()) ?Index {
......@@ -1678,7 +1678,7 @@ pub const TargetQuery = struct {
16781678 };
16791679
16801680 pub const OptionalIndex = enum(u32) {
1681 none = maxInt(u32),
1681 none = max_u32,
16821682 _,
16831683
16841684 pub fn init(i: Index) OptionalIndex {