authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-29 14:19:13+01:00
committergravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-02-29 14:19:13+01:00
log58222204353c052a62f3723f879dc16f2d608f8b
treeef9b1c9b0789c1776361ded3110e73e20209c6af
parentf072b0c056768648eb56230036dc8c973116d066

Address review comments


1 files changed, 6 insertions(+), 7 deletions(-)

lib/std/zig/system.zig+6-7
......@@ -181,7 +181,6 @@ pub const NativeTargetInfo = struct {
181181 ProcessFdQuotaExceeded,
182182 SystemFdQuotaExceeded,
183183 DeviceBusy,
184 Unexpected,
185184 };
186185
187186 /// Given a `CrossTarget`, which specifies in detail which parts of the target should be detected
......@@ -225,10 +224,9 @@ pub const NativeTargetInfo = struct {
225224 var version_info: std.os.windows.RTL_OSVERSIONINFOW = undefined;
226225 version_info.dwOSVersionInfoSize = @sizeOf(@TypeOf(version_info));
227226
228 const rc = std.os.windows.ntdll.RtlGetVersion(&version_info);
229 switch (rc) {
227 switch (std.os.windows.ntdll.RtlGetVersion(&version_info)) {
230228 .SUCCESS => {},
231 else => return std.os.windows.unexpectedStatus(rc),
229 else => unreachable,
232230 }
233231
234232 // Starting from the system infos build a NTDDI-like version
......@@ -245,15 +243,16 @@ pub const NativeTargetInfo = struct {
245243 // There's no other way to obtain this info beside
246244 // checking the build number against a known set of
247245 // values
248 for ([_]u32{
246 const known_build_numbers = [_]u32{
249247 10240, 10586, 14393, 15063, 16299, 17134, 17763,
250248 18362, 18363,
251 }) |build, i| {
249 };
250 for (known_build_numbers) |build, i| {
252251 if (version_info.dwBuildNumber < build)
253252 break :subver @truncate(u8, i);
254253 }
255254 // Unknown subversion, the OS is too new...
256 break :subver 0;
255 break :subver @truncate(u8, known_build_numbers.len);
257256 } else 0;
258257
259258 const version: u32 = @as(u32, os_ver) << 16 | @as(u32, sp_ver) << 8 | sub_ver;