zig

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

commit d71076c9826ddd66bfcc04b9a6ded9dbf540d239 (tree)
parent 624fa8523a2c4158ddc9fce231181a9e8583a633
Author: Alex Rønne Petersen <alex@alexrp.com>
Date:   Sat,  3 Aug 2024 18:46:04 +0200

std.os.linux: Replace `@hasDecl()` with `!= void` check for VDSO.

If there is a VDSO, it will have clock_gettime(). The main thing we're concerned
about is architectures that don't have a VDSO at all, of which there are a few.

Diffstat:
Mlib/std/os/linux.zig | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig @@ -1399,7 +1399,7 @@ const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C) var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime; pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize { - if (@hasDecl(VDSO, "CGT_SYM")) { + if (VDSO != void) { const ptr = @atomicLoad(?VdsoClockGettime, &vdso_clock_gettime, .unordered); if (ptr) |f| { const rc = f(clk_id, tp);