authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-04 10:39:18-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2025-06-06 23:42:14-07:00
logd6b1ff7533295eab7d6cebe75491bc4bb21e2c21
tree918d60aec99ccf1c99b4767976cd01e2e1e507f0
parent2387305b23006f23eb16d0512321c612f46abcab

Compilation.Config: eliminate the only variable from this function


1 files changed, 12 insertions(+), 15 deletions(-)

src/Compilation/Config.zig+12-15
......@@ -318,14 +318,6 @@ pub fn resolve(options: Options) ResolveError!Config {
318318 break :b false;
319319 };
320320
321 var link_libunwind = b: {
322 if (link_libcpp and target_util.libCxxNeedsLibUnwind(target)) {
323 if (options.link_libunwind == false) return error.LibCppRequiresLibUnwind;
324 break :b true;
325 }
326 break :b options.link_libunwind orelse false;
327 };
328
329321 const link_libc = b: {
330322 if (target_util.osRequiresLibC(target)) {
331323 if (options.link_libc == false) return error.OsRequiresLibC;
......@@ -335,7 +327,7 @@ pub fn resolve(options: Options) ResolveError!Config {
335327 if (options.link_libc == false) return error.LibCppRequiresLibC;
336328 break :b true;
337329 }
338 if (link_libunwind) {
330 if (options.link_libunwind == true) {
339331 if (options.link_libc == false) return error.LibUnwindRequiresLibC;
340332 break :b true;
341333 }
......@@ -406,12 +398,17 @@ pub fn resolve(options: Options) ResolveError!Config {
406398 break :b .static;
407399 };
408400
409 // This is done here to avoid excessive duplicated logic due to the complex dependencies between these options.
410 if (options.output_mode == .Exe and link_libc and target_util.libCNeedsLibUnwind(target, link_mode)) {
411 if (options.link_libunwind == false) return error.LibCRequiresLibUnwind;
412
413 link_libunwind = true;
414 }
401 const link_libunwind = b: {
402 if (options.output_mode == .Exe and link_libc and target_util.libCNeedsLibUnwind(target, link_mode)) {
403 if (options.link_libunwind == false) return error.LibCRequiresLibUnwind;
404 break :b true;
405 }
406 if (link_libcpp and target_util.libCxxNeedsLibUnwind(target)) {
407 if (options.link_libunwind == false) return error.LibCppRequiresLibUnwind;
408 break :b true;
409 }
410 break :b options.link_libunwind orelse false;
411 };
415412
416413 const import_memory = options.import_memory orelse (options.output_mode == .Obj);
417414 const export_memory = b: {