authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2020-12-30 23:41:49+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-12-30 14:45:39-08:00
log2622575fde2b5d70926fe62ed272412d72eef7b0
tree4949baa8e28e79b0e28349e55cfd89ca249a6d75
parentdaed2ba2a01ca0d65daebf5401d99bc1f2e292fa

std: Remove duplicated code

Make osRequiresLibC call Os.requiresLibC, let's keep a single list of OS that require the libc to be linked in.

2 files changed, 4 insertions(+), 4 deletions(-)

lib/std/target.zig+3
...@@ -337,6 +337,9 @@ pub const Target = struct {...@@ -337,6 +337,9 @@ pub const Target = struct {
337 };337 };
338 }338 }
339339
340 /// On Darwin, we always link libSystem which contains libc.
341 /// Similarly on FreeBSD and NetBSD we always link system libc
342 /// since this is the stable syscall interface.
340 pub fn requiresLibC(os: Os) bool {343 pub fn requiresLibC(os: Os) bool {
341 return switch (os.tag) {344 return switch (os.tag) {
342 .freebsd,345 .freebsd,
src/target.zig+1-4
...@@ -128,10 +128,7 @@ pub fn cannotDynamicLink(target: std.Target) bool {...@@ -128,10 +128,7 @@ pub fn cannotDynamicLink(target: std.Target) bool {
128/// Similarly on FreeBSD and NetBSD we always link system libc128/// Similarly on FreeBSD and NetBSD we always link system libc
129/// since this is the stable syscall interface.129/// since this is the stable syscall interface.
130pub fn osRequiresLibC(target: std.Target) bool {130pub fn osRequiresLibC(target: std.Target) bool {
131 return switch (target.os.tag) {131 return target.os.requiresLibC();
132 .freebsd, .netbsd, .dragonfly, .openbsd, .macos, .ios, .watchos, .tvos => true,
133 else => false,
134 };
135}132}
136133
137pub fn libcNeedsLibUnwind(target: std.Target) bool {134pub fn libcNeedsLibUnwind(target: std.Target) bool {