diff options
| author | Pat Tullmann <pat.github@tullmann.org> | 2024-07-21 16:03:58 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2024-07-23 11:47:29 -0700 |
| commit | e8503ecb6552087d6954423e59f3dfa8ca4a1b09 (patch) | |
| tree | fb48a161f4071dae76a3bef0af2fda6f3804b216 /lib/std | |
| parent | 33c79841832b575c2dacc7ec07ac9536798be4e3 (diff) | |
| download | zig-e8503ecb6552087d6954423e59f3dfa8ca4a1b09.tar.gz zig-e8503ecb6552087d6954423e59f3dfa8ca4a1b09.zip | |
Default std.posix.system.ucontext_t is void
PR https://github.com/ziglang/zig/pull/20679 ("std.c reorganization")
switched feature-detection code to use "T != void" checks in place of
"@hasDecl". However, the std.posix.system struct is empty, so
compile-time feature detection against symbols in there (specifically
`std.posix.system.ucontext_t` in this case), fail at compile time on
freestanding targets.
This PR adds a void ucontext_t into the std.posix.system default.
This PR also adds pseudo-"freestanding" variation of the StackIterator
"unwind" test. It is sort of hacky (its freestanding, but assumes it can
invoke a Linux exit syscall), but it does detect this problem.
Fixes #20710
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/posix.zig | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/std/posix.zig b/lib/std/posix.zig index 51ec462821..98f1ba4a85 100644 --- a/lib/std/posix.zig +++ b/lib/std/posix.zig @@ -45,7 +45,9 @@ pub const system = if (use_libc) else switch (native_os) { .linux => linux, .plan9 => std.os.plan9, - else => struct {}, + else => struct { + pub const ucontext_t = void; + }, }; pub const AF = system.AF; |
