From c9e67e71c146d9a9c217d3f47e75258a1ffeedd9 Mon Sep 17 00:00:00 2001 From: Alex Rønne Petersen Date: Thu, 3 Oct 2024 08:34:19 +0200 Subject: std.Target: Replace isARM() with isArmOrThumb() and rename it to isArm(). The old isARM() function was a portability trap. With the name it had, it seemed like the obviously correct function to use, but it didn't include Thumb. In the vast majority of cases where someone wants to ask "is the target Arm?", Thumb *should* be included. There are exactly 3 cases in the codebase where we do actually need to exclude Thumb, although one of those is in Aro and mirrors a check in Clang that is itself likely a bug. These rare cases can just add an extra isThumb() check. --- lib/std/math/gamma.zig | 2 +- lib/std/math/isnan.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/std/math') diff --git a/lib/std/math/gamma.zig b/lib/std/math/gamma.zig index 5ac041e195..aad2a104cc 100644 --- a/lib/std/math/gamma.zig +++ b/lib/std/math/gamma.zig @@ -263,7 +263,7 @@ test gamma { } test "gamma.special" { - if (builtin.cpu.arch.isArmOrThumb() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 + if (builtin.cpu.arch.isArm() and builtin.target.floatAbi() == .soft) return error.SkipZigTest; // https://github.com/ziglang/zig/issues/21234 inline for (&.{ f32, f64 }) |T| { try expect(std.math.isNan(gamma(T, -std.math.nan(T)))); diff --git a/lib/std/math/isnan.zig b/lib/std/math/isnan.zig index a85100ba90..e05ce452dd 100644 --- a/lib/std/math/isnan.zig +++ b/lib/std/math/isnan.zig @@ -32,7 +32,7 @@ test isSignalNan { // TODO: Signalling NaN values get converted to quiet NaN values in // some cases where they shouldn't such that this can fail. // See https://github.com/ziglang/zig/issues/14366 - if (!builtin.cpu.arch.isArmOrThumb() and + if (!builtin.cpu.arch.isArm() and !builtin.cpu.arch.isAARCH64() and !builtin.cpu.arch.isPowerPC() and builtin.zig_backend != .stage2_c) -- cgit v1.2.3