| author | |
| committer | |
| log | 0c41edf4978cc45b59909fce69885e310360cbfa |
| tree | e143076d2f253578e9a5a6fdd4f13e201b98e3c0 |
| parent | 45c4f781a5a831dd08cbab745a55834d514e45f5 |
| parent | f1dbf830e225c47189f71d2952512a81e18b8651 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/3556510 files changed, 140 insertions(+), 65 deletions(-)
lib/std/c.zig+20-3| ... | @@ -11134,14 +11134,23 @@ pub const ioctl = switch (native_os) { | ... | @@ -11134,14 +11134,23 @@ pub const ioctl = switch (native_os) { |
| 11134 | 11134 | ||
| 11135 | pub extern "c" fn bzero(s: *anyopaque, n: usize) void; | 11135 | pub extern "c" fn bzero(s: *anyopaque, n: usize) void; |
| 11136 | 11136 | ||
| 11137 | pub extern "c" fn swab(noalias from: *const anyopaque, noalias to: *anyopaque, n: isize) void; | 11137 | pub const swab = switch (builtin.abi) { |
| 11138 | .msvc => private._swab, | ||
| 11139 | else => private.swab, | ||
| 11140 | }; | ||
| 11138 | 11141 | ||
| 11139 | pub extern "c" fn strncmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int; | 11142 | pub extern "c" fn strncmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int; |
| 11140 | pub extern "c" fn strcasecmp(a: [*:0]const c_char, b: [*:0]const c_char) c_int; | 11143 | pub extern "c" fn strcasecmp(a: [*:0]const c_char, b: [*:0]const c_char) c_int; |
| 11141 | pub extern "c" fn strncasecmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int; | 11144 | pub extern "c" fn strncasecmp(a: [*:0]const c_char, b: [*:0]const c_char, max: usize) c_int; |
| 11142 | pub extern "c" fn strdup(s: [*:0]const c_char) ?[*:0]c_char; | 11145 | pub const strdup = switch (builtin.abi) { |
| 11146 | .msvc => private._strdup, | ||
| 11147 | else => private.strdup, | ||
| 11148 | }; | ||
| 11143 | pub extern "c" fn strndup(s: [*:0]const c_char, n: usize) ?[*:0]c_char; | 11149 | pub extern "c" fn strndup(s: [*:0]const c_char, n: usize) ?[*:0]c_char; |
| 11144 | pub extern "c" fn wcsdup(s: [*:0]const wchar_t) ?[*:0]wchar_t; | 11150 | pub const wcsdup = switch (builtin.abi) { |
| 11151 | .msvc => private._wcsdup, | ||
| 11152 | else => private.wcsdup, | ||
| 11153 | }; | ||
| 11145 | 11154 | ||
| 11146 | pub extern "c" fn ffs(i: c_int) c_int; | 11155 | pub extern "c" fn ffs(i: c_int) c_int; |
| 11147 | pub extern "c" fn ffsl(i: c_long) c_long; | 11156 | pub extern "c" fn ffsl(i: c_long) c_long; |
| ... | @@ -11555,6 +11564,14 @@ pub const setkeymap = serenity.setkeymap; | ... | @@ -11555,6 +11564,14 @@ pub const setkeymap = serenity.setkeymap; |
| 11555 | 11564 | ||
| 11556 | /// External definitions shared by two or more operating systems. | 11565 | /// External definitions shared by two or more operating systems. |
| 11557 | const private = struct { | 11566 | const private = struct { |
| 11567 | pub extern "c" fn strdup(s: [*:0]const c_char) ?[*:0]c_char; | ||
| 11568 | pub extern "c" fn _strdup(s: [*:0]const c_char) ?[*:0]c_char; | ||
| 11569 | pub extern "c" fn wcsdup(s: [*:0]const wchar_t) ?[*:0]wchar_t; | ||
| 11570 | pub extern "c" fn _wcsdup(s: [*:0]const wchar_t) ?[*:0]wchar_t; | ||
| 11571 | |||
| 11572 | pub extern "c" fn swab(noalias from: *const anyopaque, noalias to: *anyopaque, n: isize) void; | ||
| 11573 | pub extern "c" fn _swab(noalias from: *const anyopaque, noalias to: *anyopaque, n: isize) void; | ||
| 11574 | |||
| 11558 | extern "c" fn close(fd: fd_t) c_int; | 11575 | extern "c" fn close(fd: fd_t) c_int; |
| 11559 | extern "c" fn clock_getres(clk_id: clockid_t, tp: *timespec) c_int; | 11576 | extern "c" fn clock_getres(clk_id: clockid_t, tp: *timespec) c_int; |
| 11560 | extern "c" fn clock_gettime(clk_id: clockid_t, tp: *timespec) c_int; | 11577 | extern "c" fn clock_gettime(clk_id: clockid_t, tp: *timespec) c_int; |
test/behavior/call.zig+4-4| ... | @@ -277,7 +277,7 @@ test "forced tail call" { | ... | @@ -277,7 +277,7 @@ test "forced tail call" { |
| 277 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 277 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 278 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 278 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 279 | 279 | ||
| 280 | if (builtin.zig_backend == .stage2_llvm) { | 280 | if (builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) { |
| 281 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { | 281 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { |
| 282 | return error.SkipZigTest; | 282 | return error.SkipZigTest; |
| 283 | } | 283 | } |
| ... | @@ -312,7 +312,7 @@ test "inline call preserves tail call" { | ... | @@ -312,7 +312,7 @@ test "inline call preserves tail call" { |
| 312 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 312 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 313 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 313 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 314 | 314 | ||
| 315 | if (builtin.zig_backend == .stage2_llvm) { | 315 | if (builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) { |
| 316 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { | 316 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { |
| 317 | return error.SkipZigTest; | 317 | return error.SkipZigTest; |
| 318 | } | 318 | } |
| ... | @@ -708,7 +708,7 @@ test "tail call function pointer" { | ... | @@ -708,7 +708,7 @@ test "tail call function pointer" { |
| 708 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; | 708 | if (builtin.zig_backend == .stage2_spirv) return error.SkipZigTest; |
| 709 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; | 709 | if (builtin.zig_backend == .stage2_riscv64) return error.SkipZigTest; |
| 710 | 710 | ||
| 711 | if (builtin.zig_backend == .stage2_llvm) { | 711 | if (builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) { |
| 712 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { | 712 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { |
| 713 | return error.SkipZigTest; | 713 | return error.SkipZigTest; |
| 714 | } | 714 | } |
| ... | @@ -736,7 +736,7 @@ test "tail call with potentially extended types" { | ... | @@ -736,7 +736,7 @@ test "tail call with potentially extended types" { |
| 736 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 736 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 737 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | 737 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO |
| 738 | 738 | ||
| 739 | if (builtin.zig_backend == .stage2_llvm) { | 739 | if (builtin.zig_backend == .stage2_llvm or builtin.zig_backend == .stage2_c) { |
| 740 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { | 740 | if (builtin.cpu.arch.isMIPS() or builtin.cpu.arch.isPowerPC() or builtin.cpu.arch.isWasm()) { |
| 741 | return error.SkipZigTest; | 741 | return error.SkipZigTest; |
| 742 | } | 742 | } |
test/c/math.zig+3| ... | @@ -61,10 +61,13 @@ test "modf" { | ... | @@ -61,10 +61,13 @@ test "modf" { |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | test "modff" { | 63 | test "modff" { |
| 64 | if (builtin.cpu.arch == .x86 and builtin.target.os.tag == .windows and builtin.target.abi != .gnu) return; // mingw-only | ||
| 65 | |||
| 64 | try testModf(f32); | 66 | try testModf(f32); |
| 65 | } | 67 | } |
| 66 | 68 | ||
| 67 | test "modfl" { | 69 | test "modfl" { |
| 70 | if (builtin.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi != .gnu) return; // mingw-only | ||
| 68 | if (builtin.target.cpu.arch.isPowerPC()) return error.SkipZigTest; // TODO: see https://codeberg.org/ziglang/zig/issues/30976 | 71 | if (builtin.target.cpu.arch.isPowerPC()) return error.SkipZigTest; // TODO: see https://codeberg.org/ziglang/zig/issues/30976 |
| 69 | 72 | ||
| 70 | try testModf(c_longdouble); | 73 | try testModf(c_longdouble); |
test/c/pthread.zig+1| ... | @@ -7,6 +7,7 @@ const testing = std.testing; | ... | @@ -7,6 +7,7 @@ const testing = std.testing; |
| 7 | 7 | ||
| 8 | test "pthread_spinlock_t" { | 8 | test "pthread_spinlock_t" { |
| 9 | if (builtin.target.os.tag.isDarwin()) return; // Darwin doesn't have `pthread_spin_*` | 9 | if (builtin.target.os.tag.isDarwin()) return; // Darwin doesn't have `pthread_spin_*` |
| 10 | if (builtin.target.os.tag == .windows and builtin.target.abi != .gnu) return; // winpthreads-only | ||
| 10 | 11 | ||
| 11 | var spin: c.pthread_spinlock_t = undefined; | 12 | var spin: c.pthread_spinlock_t = undefined; |
| 12 | _ = c.pthread_spin_init(&spin, c.PTHREAD_PROCESS_PRIVATE); | 13 | _ = c.pthread_spin_init(&spin, c.PTHREAD_PROCESS_PRIVATE); |
test/c/stdlib.zig+14| ... | @@ -33,6 +33,7 @@ test "div" { | ... | @@ -33,6 +33,7 @@ test "div" { |
| 33 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; // TODO | 33 | if (builtin.target.cpu.arch.isMIPS64()) return error.SkipZigTest; // TODO |
| 34 | if (builtin.target.cpu.arch.isPowerPC()) return error.SkipZigTest; // TODO | 34 | if (builtin.target.cpu.arch.isPowerPC()) return error.SkipZigTest; // TODO |
| 35 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO | 35 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO |
| 36 | if (builtin.target.cpu.arch == .x86 and builtin.target.os.tag == .windows) return error.SkipZigTest; // TODO | ||
| 36 | 37 | ||
| 37 | const expected: c.div_t = .{ .quot = 5, .rem = 5 }; | 38 | const expected: c.div_t = .{ .quot = 5, .rem = 5 }; |
| 38 | try testing.expectEqual(expected, c.div(55, 10)); | 39 | try testing.expectEqual(expected, c.div(55, 10)); |
| ... | @@ -42,6 +43,7 @@ test "ldiv" { | ... | @@ -42,6 +43,7 @@ test "ldiv" { |
| 42 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | 43 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO |
| 43 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO | 44 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; // TODO |
| 44 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO | 45 | if (builtin.target.cpu.arch == .s390x) return error.SkipZigTest; // TODO |
| 46 | if (builtin.target.cpu.arch == .x86 and builtin.target.os.tag == .windows) return error.SkipZigTest; // TODO | ||
| 45 | 47 | ||
| 46 | const expected: c.ldiv_t = .{ .quot = -6, .rem = 2 }; | 48 | const expected: c.ldiv_t = .{ .quot = -6, .rem = 2 }; |
| 47 | try testing.expectEqual(expected, c.ldiv(38, -6)); | 49 | try testing.expectEqual(expected, c.ldiv(38, -6)); |
| ... | @@ -129,6 +131,8 @@ fn testStrToLLikeFunctionAnyErrno( | ... | @@ -129,6 +131,8 @@ fn testStrToLLikeFunctionAnyErrno( |
| 129 | } | 131 | } |
| 130 | 132 | ||
| 131 | test "strtol" { | 133 | test "strtol" { |
| 134 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 135 | |||
| 132 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 136 | c._errno().* = @intFromEnum(c.E.SUCCESS); |
| 133 | try testStrToLLikeFunctionAnyErrno(c.strtol, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 137 | try testStrToLLikeFunctionAnyErrno(c.strtol, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 134 | try testStrToLLikeFunction(c.strtol, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 138 | try testStrToLLikeFunction(c.strtol, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| ... | @@ -167,6 +171,8 @@ test "strtol" { | ... | @@ -167,6 +171,8 @@ test "strtol" { |
| 167 | } | 171 | } |
| 168 | 172 | ||
| 169 | test "strtoll" { | 173 | test "strtoll" { |
| 174 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 175 | |||
| 170 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 176 | c._errno().* = @intFromEnum(c.E.SUCCESS); |
| 171 | try testStrToLLikeFunctionAnyErrno(c.strtoll, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 177 | try testStrToLLikeFunctionAnyErrno(c.strtoll, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 172 | try testStrToLLikeFunction(c.strtoll, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 178 | try testStrToLLikeFunction(c.strtoll, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| ... | @@ -205,6 +211,8 @@ test "strtoll" { | ... | @@ -205,6 +211,8 @@ test "strtoll" { |
| 205 | } | 211 | } |
| 206 | 212 | ||
| 207 | test "strtoul" { | 213 | test "strtoul" { |
| 214 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 215 | |||
| 208 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 216 | c._errno().* = @intFromEnum(c.E.SUCCESS); |
| 209 | try testStrToLLikeFunctionAnyErrno(c.strtoul, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 217 | try testStrToLLikeFunctionAnyErrno(c.strtoul, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 210 | try testStrToLLikeFunction(c.strtoul, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 218 | try testStrToLLikeFunction(c.strtoul, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| ... | @@ -241,6 +249,8 @@ test "strtoul" { | ... | @@ -241,6 +249,8 @@ test "strtoul" { |
| 241 | } | 249 | } |
| 242 | 250 | ||
| 243 | test "strtoull" { | 251 | test "strtoull" { |
| 252 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 253 | |||
| 244 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 254 | c._errno().* = @intFromEnum(c.E.SUCCESS); |
| 245 | try testStrToLLikeFunctionAnyErrno(c.strtoull, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 255 | try testStrToLLikeFunctionAnyErrno(c.strtoull, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 246 | try testStrToLLikeFunction(c.strtoull, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 256 | try testStrToLLikeFunction(c.strtoull, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| ... | @@ -277,6 +287,8 @@ test "strtoull" { | ... | @@ -277,6 +287,8 @@ test "strtoull" { |
| 277 | } | 287 | } |
| 278 | 288 | ||
| 279 | test "strtoimax" { | 289 | test "strtoimax" { |
| 290 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 291 | |||
| 280 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 292 | c._errno().* = @intFromEnum(c.E.SUCCESS); |
| 281 | try testStrToLLikeFunctionAnyErrno(c.strtoimax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 293 | try testStrToLLikeFunctionAnyErrno(c.strtoimax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 282 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 294 | try testStrToLLikeFunction(c.strtoimax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
| ... | @@ -315,6 +327,8 @@ test "strtoimax" { | ... | @@ -315,6 +327,8 @@ test "strtoimax" { |
| 315 | } | 327 | } |
| 316 | 328 | ||
| 317 | test "strtoumax" { | 329 | test "strtoumax" { |
| 330 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 331 | |||
| 318 | c._errno().* = @intFromEnum(c.E.SUCCESS); | 332 | c._errno().* = @intFromEnum(c.E.SUCCESS); |
| 319 | try testStrToLLikeFunctionAnyErrno(c.strtoumax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); | 333 | try testStrToLLikeFunctionAnyErrno(c.strtoumax, @ptrCast("stop42true"), 0, 0, 0, &.{ .SUCCESS, .INVAL }); |
| 320 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); | 334 | try testStrToLLikeFunction(c.strtoumax, @ptrCast("42true"), 0, 42, 2, .SUCCESS); |
test/c/strings.zig+4| ... | @@ -48,6 +48,8 @@ test "ffs" { | ... | @@ -48,6 +48,8 @@ test "ffs" { |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | test "strcasecmp" { | 50 | test "strcasecmp" { |
| 51 | if (builtin.target.os.tag == .windows and builtin.target.abi != .gnu) return; // mingw-only | ||
| 52 | |||
| 51 | try testing.expect(c.strcasecmp(@ptrCast("a"), @ptrCast("b")) < 0); | 53 | try testing.expect(c.strcasecmp(@ptrCast("a"), @ptrCast("b")) < 0); |
| 52 | try testing.expect(c.strcasecmp(@ptrCast("b"), @ptrCast("a")) > 0); | 54 | try testing.expect(c.strcasecmp(@ptrCast("b"), @ptrCast("a")) > 0); |
| 53 | try testing.expect(c.strcasecmp(@ptrCast("A"), @ptrCast("b")) < 0); | 55 | try testing.expect(c.strcasecmp(@ptrCast("A"), @ptrCast("b")) < 0); |
| ... | @@ -58,6 +60,8 @@ test "strcasecmp" { | ... | @@ -58,6 +60,8 @@ test "strcasecmp" { |
| 58 | } | 60 | } |
| 59 | 61 | ||
| 60 | test "strncasecmp" { | 62 | test "strncasecmp" { |
| 63 | if (builtin.target.os.tag == .windows and builtin.target.abi != .gnu) return; // mingw-only | ||
| 64 | |||
| 61 | try testing.expect(c.strncasecmp(@ptrCast("a"), @ptrCast("b"), 1) < 0); | 65 | try testing.expect(c.strncasecmp(@ptrCast("a"), @ptrCast("b"), 1) < 0); |
| 62 | try testing.expect(c.strncasecmp(@ptrCast("b"), @ptrCast("a"), 1) > 0); | 66 | try testing.expect(c.strncasecmp(@ptrCast("b"), @ptrCast("a"), 1) > 0); |
| 63 | try testing.expect(c.strncasecmp(@ptrCast("A"), @ptrCast("b"), 1) < 0); | 67 | try testing.expect(c.strncasecmp(@ptrCast("A"), @ptrCast("b"), 1) < 0); |
test/c/unistd.zig+1| ... | @@ -8,6 +8,7 @@ test "swab" { | ... | @@ -8,6 +8,7 @@ test "swab" { |
| 8 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | 8 | if (builtin.target.cpu.arch.isMIPS64() and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO |
| 9 | if (builtin.target.cpu.arch == .x86_64 and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO | 9 | if (builtin.target.cpu.arch == .x86_64 and @sizeOf(usize) == 4) return error.SkipZigTest; // TODO |
| 10 | if (builtin.target.os.tag == .netbsd) return error.SkipZigTest; // TODO | 10 | if (builtin.target.os.tag == .netbsd) return error.SkipZigTest; // TODO |
| 11 | if (builtin.target.cpu.arch.isX86() and builtin.target.os.tag == .windows and builtin.target.abi == .msvc) return error.SkipZigTest; // TODO | ||
| 11 | 12 | ||
| 12 | var a: [4]u8 = undefined; | 13 | var a: [4]u8 = undefined; |
| 13 | @memset(a[0..], '\x00'); | 14 | @memset(a[0..], '\x00'); |
test/c_abi/cfuncs.c+14| ... | @@ -2846,6 +2846,7 @@ void run_c_tests(void) { | ... | @@ -2846,6 +2846,7 @@ void run_c_tests(void) { |
| 2846 | #if !defined(__mips64) | 2846 | #if !defined(__mips64) |
| 2847 | #if !defined(ZIG_PPC32) | 2847 | #if !defined(ZIG_PPC32) |
| 2848 | #if !defined(__s390x__) | 2848 | #if !defined(__s390x__) |
| 2849 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2849 | { | 2850 | { |
| 2850 | struct Struct_u8 s = zig_ret_struct_u8(); | 2851 | struct Struct_u8 s = zig_ret_struct_u8(); |
| 2851 | assert_or_panic(s.a == 1); | 2852 | assert_or_panic(s.a == 1); |
| ... | @@ -2854,10 +2855,12 @@ void run_c_tests(void) { | ... | @@ -2854,10 +2855,12 @@ void run_c_tests(void) { |
| 2854 | #endif | 2855 | #endif |
| 2855 | #endif | 2856 | #endif |
| 2856 | #endif | 2857 | #endif |
| 2858 | #endif | ||
| 2857 | 2859 | ||
| 2858 | #if !defined(__mips64) | 2860 | #if !defined(__mips64) |
| 2859 | #if !defined(ZIG_PPC32) | 2861 | #if !defined(ZIG_PPC32) |
| 2860 | #if !defined(__s390x__) | 2862 | #if !defined(__s390x__) |
| 2863 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2861 | { | 2864 | { |
| 2862 | struct Struct_u16 s = zig_ret_struct_u16(); | 2865 | struct Struct_u16 s = zig_ret_struct_u16(); |
| 2863 | assert_or_panic(s.a == 7); | 2866 | assert_or_panic(s.a == 7); |
| ... | @@ -2866,10 +2869,12 @@ void run_c_tests(void) { | ... | @@ -2866,10 +2869,12 @@ void run_c_tests(void) { |
| 2866 | #endif | 2869 | #endif |
| 2867 | #endif | 2870 | #endif |
| 2868 | #endif | 2871 | #endif |
| 2872 | #endif | ||
| 2869 | 2873 | ||
| 2870 | #if !defined(__mips64) | 2874 | #if !defined(__mips64) |
| 2871 | #if !defined(ZIG_PPC32) | 2875 | #if !defined(ZIG_PPC32) |
| 2872 | #if !defined(__s390x__) | 2876 | #if !defined(__s390x__) |
| 2877 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2873 | { | 2878 | { |
| 2874 | struct Struct_u32 s = zig_ret_struct_u32(); | 2879 | struct Struct_u32 s = zig_ret_struct_u32(); |
| 2875 | assert_or_panic(s.a == 13); | 2880 | assert_or_panic(s.a == 13); |
| ... | @@ -2878,10 +2883,12 @@ void run_c_tests(void) { | ... | @@ -2878,10 +2883,12 @@ void run_c_tests(void) { |
| 2878 | #endif | 2883 | #endif |
| 2879 | #endif | 2884 | #endif |
| 2880 | #endif | 2885 | #endif |
| 2886 | #endif | ||
| 2881 | 2887 | ||
| 2882 | #if !defined(ZIG_PPC32) | 2888 | #if !defined(ZIG_PPC32) |
| 2883 | #if !defined(ZIG_RISCV32) | 2889 | #if !defined(ZIG_RISCV32) |
| 2884 | #if !defined(__s390x__) | 2890 | #if !defined(__s390x__) |
| 2891 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2885 | { | 2892 | { |
| 2886 | struct Struct_u64 s = zig_ret_struct_u64(); | 2893 | struct Struct_u64 s = zig_ret_struct_u64(); |
| 2887 | assert_or_panic(s.a == 19); | 2894 | assert_or_panic(s.a == 19); |
| ... | @@ -2890,6 +2897,7 @@ void run_c_tests(void) { | ... | @@ -2890,6 +2897,7 @@ void run_c_tests(void) { |
| 2890 | #endif | 2897 | #endif |
| 2891 | #endif | 2898 | #endif |
| 2892 | #endif | 2899 | #endif |
| 2900 | #endif | ||
| 2893 | 2901 | ||
| 2894 | #if !defined(ZIG_PPC32) && !defined(__hexagon__) && !defined(__s390x__) | 2902 | #if !defined(ZIG_PPC32) && !defined(__hexagon__) && !defined(__s390x__) |
| 2895 | { | 2903 | { |
| ... | @@ -2908,15 +2916,18 @@ void run_c_tests(void) { | ... | @@ -2908,15 +2916,18 @@ void run_c_tests(void) { |
| 2908 | } | 2916 | } |
| 2909 | 2917 | ||
| 2910 | #if !defined(__mips64__) | 2918 | #if !defined(__mips64__) |
| 2919 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2911 | { | 2920 | { |
| 2912 | struct Struct_f32 s = zig_ret_struct_f32(); | 2921 | struct Struct_f32 s = zig_ret_struct_f32(); |
| 2913 | assert_or_panic(s.a == 2.5f); | 2922 | assert_or_panic(s.a == 2.5f); |
| 2914 | zig_struct_f32((struct Struct_f32){ .a = 2.5f }); | 2923 | zig_struct_f32((struct Struct_f32){ .a = 2.5f }); |
| 2915 | } | 2924 | } |
| 2916 | #endif | 2925 | #endif |
| 2926 | #endif | ||
| 2917 | 2927 | ||
| 2918 | #if !(defined(__arm__) && defined(__SOFTFP__)) | 2928 | #if !(defined(__arm__) && defined(__SOFTFP__)) |
| 2919 | #if !defined(ZIG_RISCV32) | 2929 | #if !defined(ZIG_RISCV32) |
| 2930 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2920 | { | 2931 | { |
| 2921 | struct Struct_f64 s = zig_ret_struct_f64(); | 2932 | struct Struct_f64 s = zig_ret_struct_f64(); |
| 2922 | assert_or_panic(s.a == 2.5); | 2933 | assert_or_panic(s.a == 2.5); |
| ... | @@ -2924,6 +2935,7 @@ void run_c_tests(void) { | ... | @@ -2924,6 +2935,7 @@ void run_c_tests(void) { |
| 2924 | } | 2935 | } |
| 2925 | #endif | 2936 | #endif |
| 2926 | #endif | 2937 | #endif |
| 2938 | #endif | ||
| 2927 | 2939 | ||
| 2928 | #if !defined(__arm__) | 2940 | #if !defined(__arm__) |
| 2929 | #if !defined(__loongarch__) | 2941 | #if !defined(__loongarch__) |
| ... | @@ -2987,6 +2999,7 @@ void run_c_tests(void) { | ... | @@ -2987,6 +2999,7 @@ void run_c_tests(void) { |
| 2987 | #endif | 2999 | #endif |
| 2988 | 3000 | ||
| 2989 | #if !defined(__powerpc__) && !defined(__loongarch__) && !defined(__mips64__) | 3001 | #if !defined(__powerpc__) && !defined(__loongarch__) && !defined(__mips64__) |
| 3002 | #if !(defined(_WIN32) && defined(__i386__)) | ||
| 2990 | { | 3003 | { |
| 2991 | struct Struct_u32_Union_u32_u32u32 s = zig_ret_struct_u32_union_u32_u32u32(); | 3004 | struct Struct_u32_Union_u32_u32u32 s = zig_ret_struct_u32_union_u32_u32u32(); |
| 2992 | assert_or_panic(s.a == 1); | 3005 | assert_or_panic(s.a == 1); |
| ... | @@ -3000,6 +3013,7 @@ void run_c_tests(void) { | ... | @@ -3000,6 +3013,7 @@ void run_c_tests(void) { |
| 3000 | zig_struct_i32_i32(s); | 3013 | zig_struct_i32_i32(s); |
| 3001 | } | 3014 | } |
| 3002 | #endif | 3015 | #endif |
| 3016 | #endif | ||
| 3003 | 3017 | ||
| 3004 | #if !defined(__powerpc64__) && !defined(__loongarch__) && !defined(__mips64__) | 3018 | #if !defined(__powerpc64__) && !defined(__loongarch__) && !defined(__mips64__) |
| 3005 | { | 3019 | { |
test/c_abi/main.zig+12| ... | @@ -291,6 +291,7 @@ test "C ABI struct u8" { | ... | @@ -291,6 +291,7 @@ test "C ABI struct u8" { |
| 291 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 291 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 292 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 292 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 293 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 293 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 294 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 294 | 295 | ||
| 295 | const s = c_ret_struct_u8(); | 296 | const s = c_ret_struct_u8(); |
| 296 | try expect(s.a == 4); | 297 | try expect(s.a == 4); |
| ... | @@ -318,6 +319,7 @@ test "C ABI struct u16" { | ... | @@ -318,6 +319,7 @@ test "C ABI struct u16" { |
| 318 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 319 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 319 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 320 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 320 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 321 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 322 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 321 | 323 | ||
| 322 | const s = c_ret_struct_u16(); | 324 | const s = c_ret_struct_u16(); |
| 323 | try expect(s.a == 10); | 325 | try expect(s.a == 10); |
| ... | @@ -345,6 +347,7 @@ test "C ABI struct u32" { | ... | @@ -345,6 +347,7 @@ test "C ABI struct u32" { |
| 345 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 347 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 346 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 348 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 347 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 349 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 350 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 348 | 351 | ||
| 349 | const s = c_ret_struct_u32(); | 352 | const s = c_ret_struct_u32(); |
| 350 | try expect(s.a == 16); | 353 | try expect(s.a == 16); |
| ... | @@ -372,6 +375,7 @@ test "C ABI struct u64" { | ... | @@ -372,6 +375,7 @@ test "C ABI struct u64" { |
| 372 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 375 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 373 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; | 376 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; |
| 374 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 377 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 378 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 375 | 379 | ||
| 376 | const s = c_ret_struct_u64(); | 380 | const s = c_ret_struct_u64(); |
| 377 | try expect(s.a == 22); | 381 | try expect(s.a == 22); |
| ... | @@ -485,6 +489,7 @@ test "C ABI struct f32" { | ... | @@ -485,6 +489,7 @@ test "C ABI struct f32" { |
| 485 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; | 489 | if (builtin.cpu.arch.isMIPS64()) return error.SkipZigTest; |
| 486 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 490 | if (builtin.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 487 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 491 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 492 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 488 | 493 | ||
| 489 | const s = c_ret_struct_f32(); | 494 | const s = c_ret_struct_f32(); |
| 490 | try expect(s.a == 2.5); | 495 | try expect(s.a == 2.5); |
| ... | @@ -513,6 +518,7 @@ test "C ABI struct f64" { | ... | @@ -513,6 +518,7 @@ test "C ABI struct f64" { |
| 513 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; | 518 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 514 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; | 519 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; |
| 515 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 520 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 521 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 516 | 522 | ||
| 517 | const s = c_ret_struct_f64(); | 523 | const s = c_ret_struct_f64(); |
| 518 | try expect(s.a == 2.5); | 524 | try expect(s.a == 2.5); |
| ... | @@ -705,6 +711,7 @@ test "C ABI struct i32 i32" { | ... | @@ -705,6 +711,7 @@ test "C ABI struct i32 i32" { |
| 705 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; | 711 | if (builtin.cpu.arch == .riscv32) return error.SkipZigTest; |
| 706 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 712 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 707 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 713 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 714 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 708 | 715 | ||
| 709 | const s: Struct_i32_i32 = .{ | 716 | const s: Struct_i32_i32 = .{ |
| 710 | .a = 1, | 717 | .a = 1, |
| ... | @@ -5681,6 +5688,7 @@ test "C ABI pointer sized float struct" { | ... | @@ -5681,6 +5688,7 @@ test "C ABI pointer sized float struct" { |
| 5681 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; | 5688 | if (builtin.cpu.arch.isArm() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 5682 | if (builtin.cpu.arch.isLoongArch() and builtin.abi.float() == .soft) return error.SkipZigTest; | 5689 | if (builtin.cpu.arch.isLoongArch() and builtin.abi.float() == .soft) return error.SkipZigTest; |
| 5683 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 5690 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 5691 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 5684 | 5692 | ||
| 5685 | c_ptr_size_float_struct(.{ .x = 1, .y = 2 }); | 5693 | c_ptr_size_float_struct(.{ .x = 1, .y = 2 }); |
| 5686 | 5694 | ||
| ... | @@ -5812,6 +5820,7 @@ test "PD: Zig passes to C" { | ... | @@ -5812,6 +5820,7 @@ test "PD: Zig passes to C" { |
| 5812 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5820 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5813 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5821 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5814 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 5822 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 5823 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 5815 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); | 5824 | try expectOk(c_assert_PD(.{ .v1 = null, .v2 = 0.5 })); |
| 5816 | } | 5825 | } |
| 5817 | test "PD: Zig returns to C" { | 5826 | test "PD: Zig returns to C" { |
| ... | @@ -5827,6 +5836,7 @@ test "PD: C passes to Zig" { | ... | @@ -5827,6 +5836,7 @@ test "PD: C passes to Zig" { |
| 5827 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 5836 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 5828 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 5837 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 5829 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 5838 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 5839 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 5830 | try expectOk(c_send_PD()); | 5840 | try expectOk(c_send_PD()); |
| 5831 | } | 5841 | } |
| 5832 | test "PD: C returns to Zig" { | 5842 | test "PD: C returns to Zig" { |
| ... | @@ -5936,6 +5946,7 @@ test "f16 struct" { | ... | @@ -5936,6 +5946,7 @@ test "f16 struct" { |
| 5936 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; | 5946 | if (builtin.target.cpu.arch.isPowerPC32()) return error.SkipZigTest; |
| 5937 | if (builtin.cpu.arch.isArm() and builtin.mode != .Debug) return error.SkipZigTest; | 5947 | if (builtin.cpu.arch.isArm() and builtin.mode != .Debug) return error.SkipZigTest; |
| 5938 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 5948 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 5949 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 5939 | 5950 | ||
| 5940 | const a = c_f16_struct(.{ .a = 12 }); | 5951 | const a = c_f16_struct(.{ .a = 12 }); |
| 5941 | try expect(a.a == 34); | 5952 | try expect(a.a == 34); |
| ... | @@ -6045,6 +6056,7 @@ test "Stdcall ABI structs" { | ... | @@ -6045,6 +6056,7 @@ test "Stdcall ABI structs" { |
| 6045 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; | 6056 | if (builtin.cpu.arch.isLoongArch()) return error.SkipZigTest; |
| 6046 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; | 6057 | if (builtin.cpu.arch == .hexagon) return error.SkipZigTest; |
| 6047 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; | 6058 | if (builtin.cpu.arch == .s390x) return error.SkipZigTest; |
| 6059 | if (builtin.cpu.arch == .x86 and builtin.os.tag == .windows) return error.SkipZigTest; | ||
| 6048 | 6060 | ||
| 6049 | const res = stdcall_coord2( | 6061 | const res = stdcall_coord2( |
| 6050 | .{ .x = 0x1111, .y = 0x2222 }, | 6062 | .{ .x = 0x1111, .y = 0x2222 }, |
test/tests.zig+67-58| ... | @@ -1611,8 +1611,6 @@ const module_test_targets = blk: { | ... | @@ -1611,8 +1611,6 @@ const module_test_targets = blk: { |
| 1611 | .abi = .msvc, | 1611 | .abi = .msvc, |
| 1612 | }, | 1612 | }, |
| 1613 | .link_libc = true, | 1613 | .link_libc = true, |
| 1614 | // https://codeberg.org/ziglang/zig/issues/35517 | ||
| 1615 | .skip_modules = &.{"libc"}, | ||
| 1616 | }, | 1614 | }, |
| 1617 | .{ | 1615 | .{ |
| 1618 | .target = .{ | 1616 | .target = .{ |
| ... | @@ -1628,8 +1626,6 @@ const module_test_targets = blk: { | ... | @@ -1628,8 +1626,6 @@ const module_test_targets = blk: { |
| 1628 | .abi = .gnu, | 1626 | .abi = .gnu, |
| 1629 | }, | 1627 | }, |
| 1630 | .link_libc = true, | 1628 | .link_libc = true, |
| 1631 | // https://codeberg.org/ziglang/zig/issues/35517 | ||
| 1632 | .skip_modules = &.{"libc"}, | ||
| 1633 | }, | 1629 | }, |
| 1634 | 1630 | ||
| 1635 | .{ | 1631 | .{ |
| ... | @@ -1657,8 +1653,6 @@ const module_test_targets = blk: { | ... | @@ -1657,8 +1653,6 @@ const module_test_targets = blk: { |
| 1657 | .abi = .msvc, | 1653 | .abi = .msvc, |
| 1658 | }, | 1654 | }, |
| 1659 | .link_libc = true, | 1655 | .link_libc = true, |
| 1660 | // https://codeberg.org/ziglang/zig/issues/35517 | ||
| 1661 | .skip_modules = &.{"libc"}, | ||
| 1662 | }, | 1656 | }, |
| 1663 | .{ | 1657 | .{ |
| 1664 | .target = .{ | 1658 | .target = .{ |
| ... | @@ -2001,14 +1995,13 @@ const c_abi_targets = blk: { | ... | @@ -2001,14 +1995,13 @@ const c_abi_targets = blk: { |
| 2001 | 1995 | ||
| 2002 | // Windows Targets | 1996 | // Windows Targets |
| 2003 | 1997 | ||
| 2004 | // https://codeberg.org/ziglang/zig/issues/35521 | 1998 | .{ |
| 2005 | //.{ | 1999 | .target = .{ |
| 2006 | // .target = .{ | 2000 | .cpu_arch = .x86, |
| 2007 | // .cpu_arch = .x86, | 2001 | .os_tag = .windows, |
| 2008 | // .os_tag = .windows, | 2002 | .abi = .gnu, |
| 2009 | // .abi = .gnu, | 2003 | }, |
| 2010 | // }, | 2004 | }, |
| 2011 | //}, | ||
| 2012 | .{ | 2005 | .{ |
| 2013 | .target = .{ | 2006 | .target = .{ |
| 2014 | .cpu_arch = .x86_64, | 2007 | .cpu_arch = .x86_64, |
| ... | @@ -2650,11 +2643,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { | ... | @@ -2650,11 +2643,6 @@ pub fn addModuleTests(b: *std.Build, options: ModuleTestOptions) *Step { |
| 2650 | 2643 | ||
| 2651 | const target = &resolved_target.result; | 2644 | const target = &resolved_target.result; |
| 2652 | 2645 | ||
| 2653 | if (target.cpu.arch == .powerpc64le and target.ofmt == .c) { | ||
| 2654 | // https://codeberg.org/ziglang/zig/issues/35522 | ||
| 2655 | continue; | ||
| 2656 | } | ||
| 2657 | |||
| 2658 | if (target.cpu.arch == .s390x and target.ofmt == .c) { | 2646 | if (target.cpu.arch == .s390x and target.ofmt == .c) { |
| 2659 | // https://codeberg.org/ziglang/zig/issues/35523 | 2647 | // https://codeberg.org/ziglang/zig/issues/35523 |
| 2660 | continue; | 2648 | continue; |
| ... | @@ -2811,45 +2799,66 @@ fn addOneModuleTest( | ... | @@ -2811,45 +2799,66 @@ fn addOneModuleTest( |
| 2811 | 2799 | ||
| 2812 | compile_c.addCSourceFile(.{ | 2800 | compile_c.addCSourceFile(.{ |
| 2813 | .file = these_tests.getEmittedBin(), | 2801 | .file = these_tests.getEmittedBin(), |
| 2814 | .flags = &.{ | 2802 | .flags = blk: { |
| 2815 | // Tracking issue for making the C backend generate C89 compatible code: | 2803 | const invariant_cflags: []const []const u8 = &.{ |
| 2816 | // https://github.com/ziglang/zig/issues/19468 | 2804 | // Tracking issue for making the C backend generate C89 compatible code: |
| 2817 | "-std=c99", | 2805 | // https://github.com/ziglang/zig/issues/19468 |
| 2818 | "-Werror", | 2806 | "-std=c99", |
| 2819 | 2807 | "-Werror", | |
| 2820 | "-Wall", | 2808 | |
| 2821 | "-Wembedded-directive", | 2809 | "-Wall", |
| 2822 | "-Wempty-translation-unit", | 2810 | "-Wembedded-directive", |
| 2823 | "-Wextra", | 2811 | "-Wempty-translation-unit", |
| 2824 | "-Wgnu", | 2812 | "-Wextra", |
| 2825 | "-Winvalid-utf8", | 2813 | "-Wgnu", |
| 2826 | "-Wkeyword-macro", | 2814 | "-Winvalid-utf8", |
| 2827 | "-Woverlength-strings", | 2815 | "-Wkeyword-macro", |
| 2828 | 2816 | "-Woverlength-strings", | |
| 2829 | // Tracking issue for making the C backend generate code | 2817 | |
| 2830 | // that does not trigger warnings: | 2818 | // Tracking issue for making the C backend generate code |
| 2831 | // https://github.com/ziglang/zig/issues/19467 | 2819 | // that does not trigger warnings: |
| 2832 | 2820 | // https://github.com/ziglang/zig/issues/19467 | |
| 2833 | // spotted everywhere | 2821 | |
| 2834 | "-Wno-builtin-requires-header", | 2822 | // spotted everywhere |
| 2835 | 2823 | "-Wno-builtin-requires-header", | |
| 2836 | // spotted on linux | 2824 | |
| 2837 | "-Wno-braced-scalar-init", | 2825 | // spotted on linux |
| 2838 | "-Wno-excess-initializers", | 2826 | "-Wno-braced-scalar-init", |
| 2839 | "-Wno-incompatible-pointer-types-discards-qualifiers", | 2827 | "-Wno-excess-initializers", |
| 2840 | "-Wno-unused", | 2828 | "-Wno-incompatible-pointer-types-discards-qualifiers", |
| 2841 | "-Wno-unused-parameter", | 2829 | "-Wno-unused", |
| 2842 | 2830 | "-Wno-unused-parameter", | |
| 2843 | // spotted on darwin | 2831 | |
| 2844 | "-Wno-incompatible-pointer-types", | 2832 | // spotted on darwin |
| 2845 | 2833 | "-Wno-incompatible-pointer-types", | |
| 2846 | // https://github.com/llvm/llvm-project/issues/153314 | 2834 | |
| 2847 | "-Wno-unterminated-string-initialization", | 2835 | // https://github.com/llvm/llvm-project/issues/153314 |
| 2848 | 2836 | "-Wno-unterminated-string-initialization", | |
| 2849 | // In both Zig and C it is legal to return a pointer to a | 2837 | |
| 2850 | // local. The C backend lowers such thing directly, so the | 2838 | // In both Zig and C it is legal to return a pointer to a |
| 2851 | // corresponding warning in C must be disabled. | 2839 | // local. The C backend lowers such thing directly, so the |
| 2852 | "-Wno-return-stack-address", | 2840 | // corresponding warning in C must be disabled. |
| 2841 | "-Wno-return-stack-address", | ||
| 2842 | }; | ||
| 2843 | |||
| 2844 | const function_data_sections = switch (target.cpu.arch) { | ||
| 2845 | .arm, | ||
| 2846 | .armeb, | ||
| 2847 | .thumb, | ||
| 2848 | .thumbeb, | ||
| 2849 | .hexagon, | ||
| 2850 | .powerpc, | ||
| 2851 | .powerpcle, | ||
| 2852 | .powerpc64, | ||
| 2853 | .powerpc64le, | ||
| 2854 | => true, | ||
| 2855 | else => false, | ||
| 2856 | }; | ||
| 2857 | |||
| 2858 | break :blk if (function_data_sections) invariant_cflags ++ &[_][]const u8{ | ||
| 2859 | "-ffunction-sections", | ||
| 2860 | "-fdata-sections", | ||
| 2861 | } else invariant_cflags; | ||
| 2853 | }, | 2862 | }, |
| 2854 | }); | 2863 | }); |
| 2855 | compile_c.addIncludePath(b.path("lib")); // for zig.h | 2864 | compile_c.addIncludePath(b.path("lib")); // for zig.h |