authorgravatar for 35231115+Rocknest@users.noreply.github.comRocknest <35231115+Rocknest@users.noreply.github.com> 2020-08-24 23:47:44+03:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2020-08-24 16:47:44-04:00
log140c599559b6e048db2ec8476cb2cc08366f6aa8
tree976a31af8da15ab8aebca675dc452d389635f1b4
parent9745e7b5126a5429da0be67899d89803e769498c
signature Signed by PGP key 4AEE18F83AFDEB23

Fix & update windows version stuff (#6157)

* Update windows version constants * Add docs

2 files changed, 11 insertions(+), 6 deletions(-)

lib/std/target.zig+10-5
......@@ -96,8 +96,12 @@ pub const Target = struct {
9696 win10_rs4 = 0x0A000005,
9797 win10_rs5 = 0x0A000006,
9898 win10_19h1 = 0x0A000007,
99 win10_20h1 = 0x0A000008,
99100 _,
100101
102 /// Latest Windows version that the Zig Standard Library is aware of
103 pub const latest = WindowsVersion.win10_20h1;
104
101105 pub const Range = struct {
102106 min: WindowsVersion,
103107 max: WindowsVersion,
......@@ -124,16 +128,17 @@ pub const Target = struct {
124128 out_stream: anytype,
125129 ) !void {
126130 if (fmt.len > 0 and fmt[0] == 's') {
127 if (@enumToInt(self) >= @enumToInt(WindowsVersion.nt4) and @enumToInt(self) <= @enumToInt(WindowsVersion.win10_19h1)) {
131 if (@enumToInt(self) >= @enumToInt(WindowsVersion.nt4) and @enumToInt(self) <= @enumToInt(WindowsVersion.latest)) {
128132 try std.fmt.format(out_stream, ".{}", .{@tagName(self)});
129133 } else {
130 try std.fmt.format(out_stream, "@intToEnum(Target.Os.WindowsVersion, {})", .{@enumToInt(self)});
134 // TODO this code path breaks zig triples, but it is used in `builtin`
135 try std.fmt.format(out_stream, "@intToEnum(Target.Os.WindowsVersion, 0x{X:0>8})", .{@enumToInt(self)});
131136 }
132137 } else {
133 if (@enumToInt(self) >= @enumToInt(WindowsVersion.nt4) and @enumToInt(self) <= @enumToInt(WindowsVersion.win10_19h1)) {
138 if (@enumToInt(self) >= @enumToInt(WindowsVersion.nt4) and @enumToInt(self) <= @enumToInt(WindowsVersion.latest)) {
134139 try std.fmt.format(out_stream, "WindowsVersion.{}", .{@tagName(self)});
135140 } else {
136 try std.fmt.format(out_stream, "WindowsVersion({})", .{@enumToInt(self)});
141 try std.fmt.format(out_stream, "WindowsVersion(0x{X:0>8})", .{@enumToInt(self)});
137142 }
138143 }
139144 }
......@@ -278,7 +283,7 @@ pub const Target = struct {
278283 .windows => return .{
279284 .windows = .{
280285 .min = .win8_1,
281 .max = .win10_19h1,
286 .max = WindowsVersion.latest,
282287 },
283288 },
284289 }
lib/std/zig/system.zig+1-1
......@@ -249,7 +249,7 @@ pub const NativeTargetInfo = struct {
249249 // values
250250 const known_build_numbers = [_]u32{
251251 10240, 10586, 14393, 15063, 16299, 17134, 17763,
252 18362, 18363,
252 18362, 19041,
253253 };
254254 var last_idx: usize = 0;
255255 for (known_build_numbers) |build, i| {