aboutsummaryrefslogtreecommitdiff
path: root/lib/std/c.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-01-24 03:45:38 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2025-02-17 19:18:19 +0100
commit481b7bf3f095488a89e20d88ada092529bc6e6f8 (patch)
tree9e4dde982be4327fb18d156d7b3540c8d03ce658 /lib/std/c.zig
parente62352611faf3056b989cc1edaa4aedaa74f326e (diff)
downloadzig-481b7bf3f095488a89e20d88ada092529bc6e6f8.tar.gz
zig-481b7bf3f095488a89e20d88ada092529bc6e6f8.zip
std.Target: Remove functions that just wrap component functions.
Functions like isMinGW() and isGnuLibC() have a good reason to exist: They look at multiple components of the target. But functions like isWasm(), isDarwin(), isGnu(), etc only exist to save 4-8 characters. I don't think this is a good enough reason to keep them, especially given that: * It's not immediately obvious to a reader whether target.isDarwin() means the same thing as target.os.tag.isDarwin() precisely because isMinGW() and similar functions *do* look at multiple components. * It's not clear where we would draw the line. The logical conclusion before this commit would be to also wrap Arch.isX86(), Os.Tag.isSolarish(), Abi.isOpenHarmony(), etc... this obviously quickly gets out of hand. * It's nice to just have a single correct way of doing something.
Diffstat (limited to 'lib/std/c.zig')
-rw-r--r--lib/std/c.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/std/c.zig b/lib/std/c.zig
index fea9bbe177..32579c04d0 100644
--- a/lib/std/c.zig
+++ b/lib/std/c.zig
@@ -2808,7 +2808,7 @@ pub const Sigaction = switch (native_os) {
.mipsel,
.mips64,
.mips64el,
- => if (builtin.target.isMusl())
+ => if (builtin.target.abi.isMusl())
linux.Sigaction
else if (builtin.target.ptrBitWidth() == 64) extern struct {
pub const handler_fn = *align(1) const fn (i32) callconv(.c) void;
@@ -6701,7 +6701,7 @@ pub const Stat = switch (native_os) {
return self.ctim;
}
},
- .mips, .mipsel => if (builtin.target.isMusl()) extern struct {
+ .mips, .mipsel => if (builtin.target.abi.isMusl()) extern struct {
dev: dev_t,
__pad0: [2]i32,
ino: ino_t,
@@ -6762,7 +6762,7 @@ pub const Stat = switch (native_os) {
return self.ctim;
}
},
- .mips64, .mips64el => if (builtin.target.isMusl()) extern struct {
+ .mips64, .mips64el => if (builtin.target.abi.isMusl()) extern struct {
dev: dev_t,
__pad0: [3]i32,
ino: ino_t,
@@ -9863,16 +9863,16 @@ pub const LC = enum(c_int) {
pub extern "c" fn setlocale(category: LC, locale: ?[*:0]const u8) ?[*:0]const u8;
-pub const getcontext = if (builtin.target.isAndroid() or builtin.target.os.tag == .openbsd)
+pub const getcontext = if (builtin.target.abi.isAndroid() or builtin.target.os.tag == .openbsd)
{} // android bionic and openbsd libc does not implement getcontext
-else if (native_os == .linux and builtin.target.isMusl())
+else if (native_os == .linux and builtin.target.abi.isMusl())
linux.getcontext
else
private.getcontext;
pub const max_align_t = if (native_abi == .msvc or native_abi == .itanium)
f64
-else if (builtin.target.isDarwin())
+else if (native_os.isDarwin())
c_longdouble
else
extern struct {