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
signaturebadge-question-mark 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 {...@@ -96,8 +96,12 @@ pub const Target = struct {
96 win10_rs4 = 0x0A000005,96 win10_rs4 = 0x0A000005,
97 win10_rs5 = 0x0A000006,97 win10_rs5 = 0x0A000006,
98 win10_19h1 = 0x0A000007,98 win10_19h1 = 0x0A000007,
99 win10_20h1 = 0x0A000008,
99 _,100 _,
100101
102 /// Latest Windows version that the Zig Standard Library is aware of
103 pub const latest = WindowsVersion.win10_20h1;
104
101 pub const Range = struct {105 pub const Range = struct {
102 min: WindowsVersion,106 min: WindowsVersion,
103 max: WindowsVersion,107 max: WindowsVersion,
...@@ -124,16 +128,17 @@ pub const Target = struct {...@@ -124,16 +128,17 @@ pub const Target = struct {
124 out_stream: anytype,128 out_stream: anytype,
125 ) !void {129 ) !void {
126 if (fmt.len > 0 and fmt[0] == 's') {130 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)) {
128 try std.fmt.format(out_stream, ".{}", .{@tagName(self)});132 try std.fmt.format(out_stream, ".{}", .{@tagName(self)});
129 } else {133 } 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)});
131 }136 }
132 } else {137 } 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)) {
134 try std.fmt.format(out_stream, "WindowsVersion.{}", .{@tagName(self)});139 try std.fmt.format(out_stream, "WindowsVersion.{}", .{@tagName(self)});
135 } else {140 } 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)});
137 }142 }
138 }143 }
139 }144 }
...@@ -278,7 +283,7 @@ pub const Target = struct {...@@ -278,7 +283,7 @@ pub const Target = struct {
278 .windows => return .{283 .windows => return .{
279 .windows = .{284 .windows = .{
280 .min = .win8_1,285 .min = .win8_1,
281 .max = .win10_19h1,286 .max = WindowsVersion.latest,
282 },287 },
283 },288 },
284 }289 }
lib/std/zig/system.zig+1-1
...@@ -249,7 +249,7 @@ pub const NativeTargetInfo = struct {...@@ -249,7 +249,7 @@ pub const NativeTargetInfo = struct {
249 // values249 // values
250 const known_build_numbers = [_]u32{250 const known_build_numbers = [_]u32{
251 10240, 10586, 14393, 15063, 16299, 17134, 17763,251 10240, 10586, 14393, 15063, 16299, 17134, 17763,
252 18362, 18363,252 18362, 19041,
253 };253 };
254 var last_idx: usize = 0;254 var last_idx: usize = 0;
255 for (known_build_numbers) |build, i| {255 for (known_build_numbers) |build, i| {