From 474d17c13ae9f9f51cb2e7f18d3d61353f1ccd83 Mon Sep 17 00:00:00 2001 From: mlugg Date: Thu, 7 Mar 2024 16:11:57 +0000 Subject: [PATCH] std.c: do not use `usingnamespace` to define getcontext Eliminates one more usage of `usingnamespace` from the standard library. --- lib/std/c.zig | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/std/c.zig b/lib/std/c.zig index cc5483cce9..26ff5e21b0 100644 --- 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