mirror of
https://github.com/ziglang/zig.git
synced 2026-01-21 06:45:24 +00:00
add tests for previous commit
This commit is contained in:
parent
8fc3a707a4
commit
149bc79486
@ -2604,7 +2604,7 @@ fn addDbgInfoType(self: *Elf, ty: Type, dbg_info_buffer: *std.ArrayList(u8)) !vo
|
||||
// DW.AT.name, DW.FORM.string
|
||||
try dbg_info_buffer.writer().print("{}\x00", .{ty});
|
||||
} else {
|
||||
log.err("TODO implement .debug_info for type '{}'", .{ty});
|
||||
log.warn("TODO implement .debug_info for type '{}'", .{ty});
|
||||
try dbg_info_buffer.append(abbrev_pad1);
|
||||
}
|
||||
},
|
||||
|
||||
@ -1819,4 +1819,36 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
":2:28: error: cannot set address space of local variable 'foo'",
|
||||
});
|
||||
}
|
||||
{
|
||||
var case = ctx.exe("issue 10138: callee preserved regs working", linux_x64);
|
||||
case.addCompareOutput(
|
||||
\\pub fn main() void {
|
||||
\\ const fd = open();
|
||||
\\ _ = write(fd, "a", 1);
|
||||
\\ _ = close(fd);
|
||||
\\}
|
||||
\\
|
||||
\\fn open() usize {
|
||||
\\ return 42;
|
||||
\\}
|
||||
\\
|
||||
\\fn write(fd: usize, a: [*]const u8, len: usize) usize {
|
||||
\\ return syscall4(.WRITE, fd, @ptrToInt(a), len);
|
||||
\\}
|
||||
\\
|
||||
\\fn syscall4(n: enum { WRITE }, a: usize, b: usize, c: usize) usize {
|
||||
\\ _ = n;
|
||||
\\ _ = a;
|
||||
\\ _ = b;
|
||||
\\ _ = c;
|
||||
\\ return 23;
|
||||
\\}
|
||||
\\
|
||||
\\fn close(fd: usize) usize {
|
||||
\\ if (fd != 42)
|
||||
\\ unreachable;
|
||||
\\ return 0;
|
||||
\\}
|
||||
, "");
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user