commit 2622575fde2b5d70926fe62ed272412d72eef7b0 (tree)
parent daed2ba2a01ca0d65daebf5401d99bc1f2e292fa
Author: LemonBoy <thatlemon@gmail.com>
Date: Wed, 30 Dec 2020 23:41:49 +0100
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.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/std/target.zig b/lib/std/target.zig
@@ -337,6 +337,9 @@ pub const Target = struct {
};
}
+ /// On Darwin, we always link libSystem which contains libc.
+ /// Similarly on FreeBSD and NetBSD we always link system libc
+ /// since this is the stable syscall interface.
pub fn requiresLibC(os: Os) bool {
return switch (os.tag) {
.freebsd,
diff --git a/src/target.zig b/src/target.zig
@@ -128,10 +128,7 @@ pub fn cannotDynamicLink(target: std.Target) bool {
/// Similarly on FreeBSD and NetBSD we always link system libc
/// since this is the stable syscall interface.
pub fn osRequiresLibC(target: std.Target) bool {
- return switch (target.os.tag) {
- .freebsd, .netbsd, .dragonfly, .openbsd, .macos, .ios, .watchos, .tvos => true,
- else => false,
- };
+ return target.os.requiresLibC();
}
pub fn libcNeedsLibUnwind(target: std.Target) bool {