zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 474d17c13ae9f9f51cb2e7f18d3d61353f1ccd83 (tree)
parent 17f83ace03a3bcb4f42958b43527792c186cd498
Author: mlugg <mlugg@mlugg.co.uk>
Date:   Thu,  7 Mar 2024 16:11:57 +0000

std.c: do not use `usingnamespace` to define getcontext

Eliminates one more usage of `usingnamespace` from the standard library.

Diffstat:
Mlib/std/c.zig | 18++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/lib/std/c.zig b/lib/std/c.zig @@ -1863,16 +1863,14 @@ pub extern "c" fn setlogmask(maskpri: c_int) c_int; pub extern "c" fn if_nametoindex([*:0]const u8) c_int; -pub usingnamespace if (builtin.target.isAndroid()) struct { - // android bionic libc does not implement getcontext, - // and std.os.linux.getcontext also cannot be built for - // bionic libc currently. -} else if (native_os == .linux and builtin.target.isMusl()) struct { - // musl does not implement getcontext - pub const getcontext = std.os.linux.getcontext; -} else struct { - pub extern "c" fn getcontext(ucp: *std.os.ucontext_t) c_int; -}; +pub const getcontext = if (builtin.target.isAndroid()) + @compileError("android bionic libc does not implement getcontext") +else if (native_os == .linux and builtin.target.isMusl()) + std.os.linux.getcontext +else + struct { + extern fn getcontext(ucp: *std.os.ucontext_t) c_int; + }.getcontext; pub const max_align_t = if (native_abi == .msvc) f64