authorgravatar for noam@pixelhero.devNoam Preil <noam@pixelhero.dev> 2020-05-27 14:09:31-04:00
committergravatar for noam@pixelhero.devNoam Preil <noam@pixelhero.dev> 2020-06-15 17:52:21-04:00
log2ed07a36f8b225d4abd531e80b73cf97e51ae0bb
tree25978c47f3df3de36460e9dbe95fba5829d346ab
parentbf8b3a4394be6b1b512531cb5217147d8bead180
signature Commit is signed but in an unrecognized format.

[Stage2/Testing] Attempt to call nakedcc function


1 files changed, 27 insertions(+), 9 deletions(-)

test/stage2/compile_errors.zig+27-9
...@@ -11,7 +11,7 @@ const linux_x64 = std.zig.CrossTarget{...@@ -11,7 +11,7 @@ const linux_x64 = std.zig.CrossTarget{
11pub fn addCases(ctx: *TestContext) !void {11pub fn addCases(ctx: *TestContext) !void {
12 // TODO: re-enable these tests.12 // TODO: re-enable these tests.
13 // https://github.com/ziglang/zig/issues/136413 // https://github.com/ziglang/zig/issues/1364
14 ctx.addZIRError("test", linux_x64,14 ctx.addZIRError("call undefined local", linux_x64,
15 \\@noreturn = primitive(noreturn)15 \\@noreturn = primitive(noreturn)
16 \\16 \\
17 \\@start_fnty = fntype([], @noreturn, cc=Naked)17 \\@start_fnty = fntype([], @noreturn, cc=Naked)
...@@ -20,14 +20,32 @@ pub fn addCases(ctx: *TestContext) !void {...@@ -20,14 +20,32 @@ pub fn addCases(ctx: *TestContext) !void {
20 \\})20 \\})
21 , &[_][]const u8{"5:13:unrecognized identifier: %test"});21 , &[_][]const u8{"5:13:unrecognized identifier: %test"});
2222
23 // ctx.addZIRError("call with non-existent target", linux_x64,23 // TODO: fix this test
24 // \\@noreturn = primitive(noreturn)24 // ctx.addZIRError("call with non-existent target", linux_x64,
25 // \\25 // \\@noreturn = primitive(noreturn)
26 // \\@start_fnty = fntype([], @noreturn, cc=Naked)26 // \\
27 // \\@start = fn(@start_fnty, {27 // \\@start_fnty = fntype([], @noreturn, cc=Naked)
28 // \\ %0 = call(@notafunc, [])28 // \\@start = fn(@start_fnty, {
29 // \\})29 // \\ %0 = call(@notafunc, [])
30 // , &[_][]const u8{"5:13:unrecognized identifier: @notafunc"});30 // \\})
31 // \\@0 = str("_start")
32 // \\@1 = ref(@0)
33 // \\@2 = export(@1, @start)
34 // , &[_][]const u8{"5:13:unrecognized identifier: @notafunc"});
35
36 // TODO: this error should occur at the call site, not the fntype decl
37 ctx.addZIRError("call naked function", linux_x64,
38 \\@noreturn = primitive(noreturn)
39 \\
40 \\@start_fnty = fntype([], @noreturn, cc=Naked)
41 \\@s = fn(@start_fnty, {})
42 \\@start = fn(@start_fnty, {
43 \\ %0 = call(@s, [])
44 \\})
45 \\@0 = str("_start")
46 \\@1 = ref(@0)
47 \\@2 = export(@1, @start)
48 , &[_][]const u8{"4:9:unable to call function with naked calling convention"});
3149
32 //try ctx.testCompileError(50 //try ctx.testCompileError(
33 // \\export fn entry() void {}51 // \\export fn entry() void {}