mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
kubkon review changes: 4
- fix `darwin_sdk_layout.?` with null checks
This commit is contained in:
parent
ebd0776b28
commit
0c8bf405eb
@ -652,7 +652,7 @@ pub fn resolveLibSystem(
|
||||
"libSystem",
|
||||
)) break :success;
|
||||
|
||||
switch (self.base.options.darwin_sdk_layout.?) {
|
||||
if (self.base.options.darwin_sdk_layout) |sdk_layout| switch (sdk_layout) {
|
||||
.sdk => {
|
||||
const dir = try fs.path.join(tmp_arena, &[_][]const u8{ self.base.options.sysroot.?, "usr", "lib" });
|
||||
if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success;
|
||||
@ -661,7 +661,7 @@ pub fn resolveLibSystem(
|
||||
const dir = try comp.zig_lib_directory.join(tmp_arena, &[_][]const u8{ "libc", "darwin" });
|
||||
if (try accessLibPath(tmp_arena, &test_path, &checked_paths, dir, "libSystem")) break :success;
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
try self.reportMissingLibraryError(checked_paths.items, "unable to find libSystem system library", .{});
|
||||
return;
|
||||
|
||||
@ -474,7 +474,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe
|
||||
|
||||
const options = comp.bin_file.options;
|
||||
|
||||
const sdk_layout = options.darwin_sdk_layout.?;
|
||||
const sdk_layout = options.darwin_sdk_layout orelse return null;
|
||||
const sdk_dir = switch (sdk_layout) {
|
||||
.sdk => options.sysroot.?,
|
||||
.vendored => std.fs.path.join(arena, &.{ comp.zig_lib_directory.path.?, "libc", "darwin" }) catch return null,
|
||||
@ -482,7 +482,7 @@ pub fn inferSdkVersion(gpa: Allocator, comp: *const Compilation) ?std.SemanticVe
|
||||
if (readSdkVersionFromSettings(arena, sdk_dir)) |ver| {
|
||||
return parseSdkVersion(ver);
|
||||
} else |_| {
|
||||
// We control vendored and reading settings should always succeed.
|
||||
// Read from settings should always succeed when vendored.
|
||||
if (sdk_layout == .vendored) @panic("zig installation bug: unable to parse SDK version");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user