authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-09-16 10:45:31+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-10-08 15:54:55+02:00
log39a2722837816f6242dae23a158f35803772072d
tree55cdcceb99b9d68fb70c1b46f93bf66e2b0b595b
parentc0b4688393fa1a96065c2407622fcb4663c350a3
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

test: refactor compatible32bitArch() -> supportedCompatArch()

Also fix some inaccuracies in it.

1 files changed, 22 insertions(+), 25 deletions(-)

test/tests.zig+22-25
...@@ -2350,38 +2350,38 @@ pub const debugger_matrix: []const RunnerTarget = &.{...@@ -2350,38 +2350,38 @@ pub const debugger_matrix: []const RunnerTarget = &.{
2350 },2350 },
2351};2351};
23522352
2353fn compatible32bitArch(host: *const std.Target) ?std.Target.Cpu.Arch {2353fn supportedCompatArch(host: *const std.Target, arch: std.Target.Cpu.Arch) bool {
2354 return switch (host.os.tag) {2354 return switch (host.os.tag) {
2355 .freebsd => switch (host.cpu.arch) {2355 .freebsd => switch (host.cpu.arch) {
2356 .aarch64 => .arm,2356 .aarch64 => arch == .arm,
2357 .powerpc64 => .powerpc,2357 else => false,
2358 else => null,
2359 },2358 },
2360 .illumos => switch (host.cpu.arch) {2359 .illumos => switch (host.cpu.arch) {
2361 .x86_64 => .x86,2360 .x86_64 => arch == .x86,
2362 else => null,2361 else => false,
2363 },2362 },
2364 .linux => switch (host.cpu.arch) {2363 .linux => switch (host.cpu.arch) {
2365 .aarch64 => .arm,2364 .aarch64 => arch == .arm or arch == .thumb,
2366 .aarch64_be => .armeb,2365 .aarch64_be => arch == .armeb or arch == .thumbeb,
2367 .mips64 => .mips,2366 .mips64 => arch == .mips,
2368 .mips64el => .mipsel,2367 .mips64el => arch == .mipsel,
2369 .powerpc64 => .powerpc,2368 .powerpc64 => arch == .powerpc,
2370 .sparc64 => .sparc,2369 .riscv64 => arch == .riscv32,
2371 .x86_64 => .x86,2370 .sparc64 => arch == .sparc,
2372 else => null,2371 .x86_64 => arch == .x86,
2372 else => false,
2373 },2373 },
2374 .netbsd => switch (host.cpu.arch) {2374 .netbsd => switch (host.cpu.arch) {
2375 .riscv64 => .riscv32,2375 .riscv64 => arch == .riscv32,
2376 .sparc64 => .sparc,2376 .sparc64 => arch == .sparc,
2377 .x86_64 => .x86,2377 .x86_64 => arch == .x86,
2378 else => null,2378 else => false,
2379 },2379 },
2380 .windows => switch (host.cpu.arch) {2380 .windows => switch (host.cpu.arch) {
2381 .x86_64 => .x86,2381 .x86_64 => arch == .x86,
2382 else => null,2382 else => false,
2383 },2383 },
2384 else => null,2384 else => false,
2385 };2385 };
2386}2386}
23872387
...@@ -2389,11 +2389,8 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std...@@ -2389,11 +2389,8 @@ pub fn isNative(actual_target: *const std.Build.ResolvedTarget, host: *const std
2389 if (actual_target.query.isNative()) return true;2389 if (actual_target.query.isNative()) return true;
2390 const actual = &actual_target.result;2390 const actual = &actual_target.result;
23912391
2392 if (actual.cpu.arch != host.cpu.arch and2392 if (actual.cpu.arch != host.cpu.arch and !supportedCompatArch(host, actual.cpu.arch))
2393 actual.cpu.arch != compatible32bitArch(host))
2394 {
2395 return false;2393 return false;
2396 }
23972394
2398 if (actual.os.tag != host.os.tag)2395 if (actual.os.tag != host.os.tag)
2399 return false;2396 return false;