OOM -> catch unreachable
This commit is contained in:
@@ -17,9 +17,9 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
}
|
||||
|
||||
{
|
||||
var case = try ctx.addExe("hello world with updates", linux_x64, .Zig);
|
||||
var case = ctx.addExe("hello world with updates", linux_x64, .Zig);
|
||||
// Regular old hello world
|
||||
try case.addCompareOutput(
|
||||
case.addCompareOutput(
|
||||
\\export fn _start() noreturn {
|
||||
\\ print();
|
||||
\\
|
||||
@@ -51,7 +51,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"Hello, World!\n",
|
||||
);
|
||||
// Now change the message only
|
||||
try case.addCompareOutput(
|
||||
case.addCompareOutput(
|
||||
\\export fn _start() noreturn {
|
||||
\\ print();
|
||||
\\
|
||||
@@ -83,7 +83,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
"What is up? This is a longer message that will force the data to be relocated in virtual address space.\n",
|
||||
);
|
||||
// Now we print it twice.
|
||||
try case.addCompareOutput(
|
||||
case.addCompareOutput(
|
||||
\\export fn _start() noreturn {
|
||||
\\ print();
|
||||
\\ print();
|
||||
|
||||
@@ -9,7 +9,7 @@ const linux_x64 = std.zig.CrossTarget{
|
||||
};
|
||||
|
||||
pub fn addCases(ctx: *TestContext) !void {
|
||||
try ctx.addError("call undefined local", linux_x64, .ZIR,
|
||||
ctx.addError("call undefined local", linux_x64, .ZIR,
|
||||
\\@noreturn = primitive(noreturn)
|
||||
\\
|
||||
\\@start_fnty = fntype([], @noreturn, cc=Naked)
|
||||
@@ -19,7 +19,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
// TODO: address inconsistency in this message and the one in the next test
|
||||
, &[_][]const u8{":5:13: error: unrecognized identifier: %test"});
|
||||
|
||||
try ctx.addError("call with non-existent target", linux_x64, .ZIR,
|
||||
ctx.addError("call with non-existent target", linux_x64, .ZIR,
|
||||
\\@noreturn = primitive(noreturn)
|
||||
\\
|
||||
\\@start_fnty = fntype([], @noreturn, cc=Naked)
|
||||
@@ -31,7 +31,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
, &[_][]const u8{":5:13: error: decl 'notafunc' not found"});
|
||||
|
||||
// TODO: this error should occur at the call site, not the fntype decl
|
||||
try ctx.addError("call naked function", linux_x64, .ZIR,
|
||||
ctx.addError("call naked function", linux_x64, .ZIR,
|
||||
\\@noreturn = primitive(noreturn)
|
||||
\\
|
||||
\\@start_fnty = fntype([], @noreturn, cc=Naked)
|
||||
@@ -46,51 +46,51 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
// TODO: re-enable these tests.
|
||||
// https://github.com/ziglang/zig/issues/1364
|
||||
|
||||
// try ctx.addError("Export same symbol twice", linux_x64, .Zig,
|
||||
// ctx.addError("Export same symbol twice", linux_x64, .Zig,
|
||||
// \\export fn entry() void {}
|
||||
// \\export fn entry() void {}
|
||||
// , &[_][]const u8{":2:1: error: exported symbol collision"});
|
||||
|
||||
// try ctx.addError("Missing function name", linux_x64, .Zig,
|
||||
// ctx.addError("Missing function name", linux_x64, .Zig,
|
||||
// \\fn() void {}
|
||||
// , &[_][]const u8{":1:3: error: missing function name"});
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\comptime {
|
||||
// \\ return;
|
||||
// \\}
|
||||
//, "1.zig", 2, 5, "return expression outside function definition");
|
||||
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\export fn entry() void {
|
||||
// \\ defer return;
|
||||
// \\}
|
||||
//, "1.zig", 2, 11, "cannot return from defer expression");
|
||||
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\export fn entry() c_int {
|
||||
// \\ return 36893488147419103232;
|
||||
// \\}
|
||||
//, "1.zig", 2, 12, "integer value '36893488147419103232' cannot be stored in type 'c_int'");
|
||||
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\comptime {
|
||||
// \\ var a: *align(4) align(4) i32 = 0;
|
||||
// \\}
|
||||
//, "1.zig", 2, 22, "Extra align qualifier");
|
||||
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\comptime {
|
||||
// \\ var b: *const const i32 = 0;
|
||||
// \\}
|
||||
//, "1.zig", 2, 19, "Extra align qualifier");
|
||||
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\comptime {
|
||||
// \\ var c: *volatile volatile i32 = 0;
|
||||
// \\}
|
||||
//, "1.zig", 2, 22, "Extra align qualifier");
|
||||
|
||||
//try ctx.testCompileError(
|
||||
//ctx.testCompileError(
|
||||
// \\comptime {
|
||||
// \\ var d: *allowzero allowzero i32 = 0;
|
||||
// \\}
|
||||
|
||||
@@ -9,7 +9,7 @@ const linux_x64 = std.zig.CrossTarget{
|
||||
};
|
||||
|
||||
pub fn addCases(ctx: *TestContext) !void {
|
||||
try ctx.addTransform("referencing decls which appear later in the file", linux_x64, .ZIR,
|
||||
ctx.addTransform("referencing decls which appear later in the file", linux_x64, .ZIR,
|
||||
\\@void = primitive(void)
|
||||
\\@fnty = fntype([], @void, cc=C)
|
||||
\\
|
||||
@@ -32,7 +32,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\})
|
||||
\\
|
||||
);
|
||||
try ctx.addTransform("elemptr, add, cmp, condbr, return, breakpoint", linux_x64, .ZIR,
|
||||
ctx.addTransform("elemptr, add, cmp, condbr, return, breakpoint", linux_x64, .ZIR,
|
||||
\\@void = primitive(void)
|
||||
\\@usize = primitive(usize)
|
||||
\\@fnty = fntype([], @void, cc=C)
|
||||
@@ -86,8 +86,8 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
);
|
||||
|
||||
{
|
||||
var case = try ctx.addObj("reference cycle with compile error in the cycle", linux_x64, .ZIR);
|
||||
try case.addTransform(
|
||||
var case = ctx.addObj("reference cycle with compile error in the cycle", linux_x64, .ZIR);
|
||||
case.addTransform(
|
||||
\\@void = primitive(void)
|
||||
\\@fnty = fntype([], @void, cc=C)
|
||||
\\
|
||||
@@ -133,7 +133,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\
|
||||
);
|
||||
// Now we introduce a compile error
|
||||
try case.addError(
|
||||
case.addError(
|
||||
\\@void = primitive(void)
|
||||
\\@fnty = fntype([], @void, cc=C)
|
||||
\\
|
||||
@@ -163,7 +163,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
// Now we remove the call to `a`. `a` and `b` form a cycle, but no entry points are
|
||||
// referencing either of them. This tests that the cycle is detected, and the error
|
||||
// goes away.
|
||||
try case.addTransform(
|
||||
case.addTransform(
|
||||
\\@void = primitive(void)
|
||||
\\@fnty = fntype([], @void, cc=C)
|
||||
\\
|
||||
@@ -207,7 +207,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
return;
|
||||
}
|
||||
|
||||
try ctx.addCompareOutput("hello world ZIR", .ZIR,
|
||||
ctx.addCompareOutput("hello world ZIR", .ZIR,
|
||||
\\@noreturn = primitive(noreturn)
|
||||
\\@void = primitive(void)
|
||||
\\@usize = primitive(usize)
|
||||
@@ -265,7 +265,7 @@ pub fn addCases(ctx: *TestContext) !void {
|
||||
\\
|
||||
);
|
||||
|
||||
try ctx.addCompareOutput("function call with no args no return value", .ZIR,
|
||||
ctx.addCompareOutput("function call with no args no return value", .ZIR,
|
||||
\\@noreturn = primitive(noreturn)
|
||||
\\@void = primitive(void)
|
||||
\\@usize = primitive(usize)
|
||||
|
||||
Reference in New Issue
Block a user