aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2025-06-04 10:39:18 -0700
committerAndrew Kelley <andrew@ziglang.org>2025-06-06 23:42:14 -0700
commitd6b1ff7533295eab7d6cebe75491bc4bb21e2c21 (patch)
tree918d60aec99ccf1c99b4767976cd01e2e1e507f0 /src/Compilation
parent2387305b23006f23eb16d0512321c612f46abcab (diff)
downloadzig-d6b1ff7533295eab7d6cebe75491bc4bb21e2c21.tar.gz
zig-d6b1ff7533295eab7d6cebe75491bc4bb21e2c21.zip
Compilation.Config: eliminate the only variable from this function
Diffstat (limited to 'src/Compilation')
-rw-r--r--src/Compilation/Config.zig27
1 files changed, 12 insertions, 15 deletions
diff --git a/src/Compilation/Config.zig b/src/Compilation/Config.zig
index 850055a5ae..1856305299 100644
--- a/src/Compilation/Config.zig
+++ b/src/Compilation/Config.zig
@@ -318,14 +318,6 @@ pub fn resolve(options: Options) ResolveError!Config {
break :b false;
};
- var link_libunwind = b: {
- if (link_libcpp and target_util.libCxxNeedsLibUnwind(target)) {
- if (options.link_libunwind == false) return error.LibCppRequiresLibUnwind;
- break :b true;
- }
- break :b options.link_libunwind orelse false;
- };
-
const link_libc = b: {
if (target_util.osRequiresLibC(target)) {
if (options.link_libc == false) return error.OsRequiresLibC;
@@ -335,7 +327,7 @@ pub fn resolve(options: Options) ResolveError!Config {
if (options.link_libc == false) return error.LibCppRequiresLibC;
break :b true;
}
- if (link_libunwind) {
+ if (options.link_libunwind == true) {
if (options.link_libc == false) return error.LibUnwindRequiresLibC;
break :b true;
}
@@ -406,12 +398,17 @@ pub fn resolve(options: Options) ResolveError!Config {
break :b .static;
};
- // This is done here to avoid excessive duplicated logic due to the complex dependencies between these options.
- if (options.output_mode == .Exe and link_libc and target_util.libCNeedsLibUnwind(target, link_mode)) {
- if (options.link_libunwind == false) return error.LibCRequiresLibUnwind;
-
- link_libunwind = true;
- }
+ const link_libunwind = b: {
+ if (options.output_mode == .Exe and link_libc and target_util.libCNeedsLibUnwind(target, link_mode)) {
+ if (options.link_libunwind == false) return error.LibCRequiresLibUnwind;
+ break :b true;
+ }
+ if (link_libcpp and target_util.libCxxNeedsLibUnwind(target)) {
+ if (options.link_libunwind == false) return error.LibCppRequiresLibUnwind;
+ break :b true;
+ }
+ break :b options.link_libunwind orelse false;
+ };
const import_memory = options.import_memory orelse (options.output_mode == .Obj);
const export_memory = b: {