aboutsummaryrefslogtreecommitdiff
path: root/test/compile_errors.zig
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2020-11-19 19:03:08 +0200
committerGitHub <noreply@github.com>2020-11-19 19:03:08 +0200
commitcf819b95fe7dec15f4ed87cd4bd8ae0be8ce7fdf (patch)
tree612ec79d1895e59d3ac50a8a2b8c0d59d34d2772 /test/compile_errors.zig
parent25ec2dbc1e2302d1138749262b588d3e438fcd55 (diff)
parent3a28b659bd66a1312f5586b7fc8afdd6c6a32eb2 (diff)
downloadzig-cf819b95fe7dec15f4ed87cd4bd8ae0be8ce7fdf.tar.gz
zig-cf819b95fe7dec15f4ed87cd4bd8ae0be8ce7fdf.zip
Merge pull request #6829 from tadeokondrak/error-unsupported-callconv
stage1: Compile error instead of falling back to C for unsupported cc
Diffstat (limited to 'test/compile_errors.zig')
-rw-r--r--test/compile_errors.zig78
1 files changed, 78 insertions, 0 deletions
diff --git a/test/compile_errors.zig b/test/compile_errors.zig
index 420ec1e564..3757415d23 100644
--- a/test/compile_errors.zig
+++ b/test/compile_errors.zig
@@ -57,6 +57,84 @@ pub fn addCases(cases: *tests.CompileErrorContext) void {
"tmp.zig:1:22: note: type u2 cannot fit values in range 0...4",
});
+ cases.addCase(x: {
+ var tc = cases.create("callconv(.Interrupt) on unsupported platform",
+ \\export fn entry() callconv(.Interrupt) void {}
+ , &[_][]const u8{
+ "tmp.zig:1:28: error: callconv 'Interrupt' is only available on x86, x86_64, AVR, and MSP430, not aarch64",
+ });
+ tc.target = std.zig.CrossTarget{
+ .cpu_arch = .aarch64,
+ .os_tag = .linux,
+ .abi = .none,
+ };
+ break :x tc;
+ });
+
+ cases.addCase(x: {
+ var tc = cases.create("callconv(.Signal) on unsupported platform",
+ \\export fn entry() callconv(.Signal) void {}
+ , &[_][]const u8{
+ "tmp.zig:1:28: error: callconv 'Signal' is only available on AVR, not x86_64",
+ });
+ tc.target = std.zig.CrossTarget{
+ .cpu_arch = .x86_64,
+ .os_tag = .linux,
+ .abi = .none,
+ };
+ break :x tc;
+ });
+
+ cases.addCase(x: {
+ var tc = cases.create("callconv(.Stdcall, .Fastcall, .Thiscall) on unsupported platform",
+ \\export fn entry1() callconv(.Stdcall) void {}
+ \\export fn entry2() callconv(.Fastcall) void {}
+ \\export fn entry3() callconv(.Thiscall) void {}
+ , &[_][]const u8{
+ "tmp.zig:1:29: error: callconv 'Stdcall' is only available on x86, not x86_64",
+ "tmp.zig:2:29: error: callconv 'Fastcall' is only available on x86, not x86_64",
+ "tmp.zig:3:29: error: callconv 'Thiscall' is only available on x86, not x86_64",
+ });
+ tc.target = std.zig.CrossTarget{
+ .cpu_arch = .x86_64,
+ .os_tag = .linux,
+ .abi = .none,
+ };
+ break :x tc;
+ });
+
+ cases.addCase(x: {
+ var tc = cases.create("callconv(.Vectorcall) on unsupported platform",
+ \\export fn entry() callconv(.Vectorcall) void {}
+ , &[_][]const u8{
+ "tmp.zig:1:28: error: callconv 'Vectorcall' is only available on x86 and AArch64, not x86_64",
+ });
+ tc.target = std.zig.CrossTarget{
+ .cpu_arch = .x86_64,
+ .os_tag = .linux,
+ .abi = .none,
+ };
+ break :x tc;
+ });
+
+ cases.addCase(x: {
+ var tc = cases.create("callconv(.APCS, .AAPCS, .AAPCSVFP) on unsupported platform",
+ \\export fn entry1() callconv(.APCS) void {}
+ \\export fn entry2() callconv(.AAPCS) void {}
+ \\export fn entry3() callconv(.AAPCSVFP) void {}
+ , &[_][]const u8{
+ "tmp.zig:1:29: error: callconv 'APCS' is only available on ARM, not x86_64",
+ "tmp.zig:2:29: error: callconv 'AAPCS' is only available on ARM, not x86_64",
+ "tmp.zig:3:29: error: callconv 'AAPCSVFP' is only available on ARM, not x86_64",
+ });
+ tc.target = std.zig.CrossTarget{
+ .cpu_arch = .x86_64,
+ .os_tag = .linux,
+ .abi = .none,
+ };
+ break :x tc;
+ });
+
cases.add("unreachable executed at comptime",
\\fn foo(comptime x: i32) i32 {
\\ comptime {