authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-02 15:20:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-03 09:52:15-07:00
log469af6780408cf3f2d7ce0c16e2d3b797dd525f1
tree5d3aec863977c1b6b991561ff9fe389c80ab58d9
parentd7e74f7cbfe3adfe70ae1d7b92509f81fce28a5a

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.

1 files changed, 2 insertions(+), 14 deletions(-)

src/main.zig+2-14
...@@ -1151,9 +1151,6 @@ fn buildOutputType(...@@ -1151,9 +1151,6 @@ fn buildOutputType(
1151 try system_libs.put(args_iter.nextOrFatal(), .{1151 try system_libs.put(args_iter.nextOrFatal(), .{
1152 .needed = false,1152 .needed = false,
1153 .weak = false,1153 .weak = false,
1154 // -l always dynamic links. For static libraries,
1155 // users are expected to use positional arguments
1156 // which are always unambiguous.
1157 .preferred_mode = lib_preferred_mode,1154 .preferred_mode = lib_preferred_mode,
1158 .search_strategy = lib_search_strategy,1155 .search_strategy = lib_search_strategy,
1159 });1156 });
...@@ -1560,9 +1557,6 @@ fn buildOutputType(...@@ -1560,9 +1557,6 @@ fn buildOutputType(
1560 try system_libs.put(arg["-l".len..], .{1557 try system_libs.put(arg["-l".len..], .{
1561 .needed = false,1558 .needed = false,
1562 .weak = false,1559 .weak = false,
1563 // -l always dynamic links. For static libraries,
1564 // users are expected to use positional arguments
1565 // which are always unambiguous.
1566 .preferred_mode = lib_preferred_mode,1560 .preferred_mode = lib_preferred_mode,
1567 .search_strategy = lib_search_strategy,1561 .search_strategy = lib_search_strategy,
1568 });1562 });
...@@ -2675,7 +2669,7 @@ fn buildOutputType(...@@ -2675,7 +2669,7 @@ fn buildOutputType(
2675 .lib = .{2669 .lib = .{
2676 .needed = true,2670 .needed = true,
2677 .weak = false,2671 .weak = false,
2678 .path = undefined,2672 .path = null,
2679 },2673 },
2680 });2674 });
2681 continue;2675 continue;
...@@ -2700,11 +2694,6 @@ fn buildOutputType(...@@ -2700,11 +2694,6 @@ fn buildOutputType(
2700 }2694 }
2701 // After this point, external_system_libs is used instead of system_libs.2695 // After this point, external_system_libs is used instead of system_libs.
27022696
2703 // libc++ depends on libc
2704 if (link_libcpp) {
2705 link_libc = true;
2706 }
2707
2708 // Trigger native system library path detection if necessary.2697 // Trigger native system library path detection if necessary.
2709 if (sysroot == null and cross_target.isNativeOs() and2698 if (sysroot == null and cross_target.isNativeOs() and
2710 (external_system_libs.len != 0 or want_native_include_dirs))2699 (external_system_libs.len != 0 or want_native_include_dirs))
...@@ -6343,13 +6332,12 @@ fn accessLibPath(...@@ -6343,13 +6332,12 @@ fn accessLibPath(
6343 // In the case of Darwin, the main check will be .dylib, so here we6332 // In the case of Darwin, the main check will be .dylib, so here we
6344 // additionally check for .so files.6333 // additionally check for .so files.
6345 if (target.isDarwin() and link_mode == .Dynamic) so: {6334 if (target.isDarwin() and link_mode == .Dynamic) so: {
6346 // Prefer .tbd over .dylib.
6347 test_path.clearRetainingCapacity();6335 test_path.clearRetainingCapacity();
6348 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ lib_dir_path, lib_name });6336 try test_path.writer().print("{s}" ++ sep ++ "lib{s}.so", .{ lib_dir_path, lib_name });
6349 try checked_paths.writer().print("\n {s}", .{test_path.items});6337 try checked_paths.writer().print("\n {s}", .{test_path.items});
6350 fs.cwd().access(test_path.items, .{}) catch |err| switch (err) {6338 fs.cwd().access(test_path.items, .{}) catch |err| switch (err) {
6351 error.FileNotFound => break :so,6339 error.FileNotFound => break :so,
6352 else => |e| fatal("unable to search for tbd library '{s}': {s}", .{6340 else => |e| fatal("unable to search for so library '{s}': {s}", .{
6353 test_path.items, @errorName(e),6341 test_path.items, @errorName(e),
6354 }),6342 }),
6355 };6343 };