CLI: delete redundant logic and use null instead of undef

The `null` value here was missed in
0a4d4eb252a73555a568a532902951a13284d2ef. I hope it is the cause of the
CI failures on Windows.

The fact that libc++ depends on libc is not important for the CLI and
Compilation.create already handles that logic.
This commit is contained in:
Andrew Kelley 2023-08-02 15:20:28 -07:00
parent d7e74f7cbf
commit 469af67804

View file

@ -1151,9 +1151,6 @@ fn buildOutputType(
try system_libs.put(args_iter.nextOrFatal(), .{
.needed = false,
.weak = false,
// -l always dynamic links. For static libraries,
// users are expected to use positional arguments
// which are always unambiguous.
.preferred_mode = lib_preferred_mode,
.search_strategy = lib_search_strategy,
});
@ -1560,9 +1557,6 @@ fn buildOutputType(
try system_libs.put(arg["-l".len..], .{
.needed = false,
.weak = false,
// -l always dynamic links. For static libraries,
// users are expected to use positional arguments
// which are always unambiguous.
.preferred_mode = lib_preferred_mode,
.search_strategy = lib_search_strategy,
});
@ -2675,7 +2669,7 @@ fn buildOutputType(
.lib = .{
.needed = true,
.weak = false,
.path = undefined,
.path = null,
},
});
continue;
@ -2700,11 +2694,6 @@ fn buildOutputType(
}
// After this point, external_system_libs is used instead of system_libs.
// libc++ depends on libc
if (link_libcpp) {
link_libc = true;
}
// Trigger native system library path detection if necessary.
if (sysroot == null and cross_target.isNativeOs() and
(external_system_libs.len != 0 or want_native_include_dirs))
@ -6343,13 +6332,12 @@ fn accessLibPath(
// In the case of Darwin, the main check will be .dylib, so here we
// additionally check for .so files.
if (target.isDarwin() and link_mode == .Dynamic) so: {
// Prefer .tbd over .dylib.
test_path.clearRetainingCapacity();
try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ lib_dir_path, lib_name });
try checked_paths.writer().print("\n {s}", .{test_path.items});
fs.cwd().access(test_path.items, .{}) catch |err| switch (err) {
error.FileNotFound => break :so,
else => |e| fatal("unable to search for tbd library '{s}': {s}", .{
else => |e| fatal("unable to search for so library '{s}': {s}", .{
test_path.items, @errorName(e),
}),
};