@@ -9700,6 +9700,18 @@ fn funcCommon(
9700
9700
{
9701
9701
return sema.fail(block, param_src, "non-pointer parameter declared noalias", .{});
9702
9702
}
9703
+
9704
+ if (cc_resolved == .Interrupt) switch (target.cpu.arch) {
9705
+ .x86, .x86_64 => {
9706
+ const err_code_size = target.ptrBitWidth();
9707
+ switch (i) {
9708
+ 0 => if (param_ty.zigTypeTag(mod) != .Pointer) return sema.fail(block, param_src, "parameter must be a pointer type", .{}),
9709
+ 1 => if (param_ty.bitSize(mod) != err_code_size) return sema.fail(block, param_src, "parameter must be a {d}-bit integer", .{err_code_size}),
9710
+ else => return sema.fail(block, param_src, "Interrupt calling convention supports up to 2 parameters, found {d}", .{i + 1}),
9711
+ }
9712
+ },
9713
+ else => return sema.fail(block, param_src, "parameters are not allowed with Interrupt calling convention", .{}),
9714
+ };
9703
9715
}
9704
9716
9705
9717
var ret_ty_requires_comptime = false;
@@ -10048,6 +10060,15 @@ fn finishFunc(
10048
10060
});
10049
10061
}
10050
10062
10063
+ if (cc_resolved == .Interrupt and return_type.zigTypeTag(mod) != .Void) {
10064
+ return sema.fail(
10065
+ block,
10066
+ cc_src,
10067
+ "non-void return type '{}' not allowed in function with calling convention 'Interrupt'",
10068
+ .{return_type.fmt(mod)},
10069
+ );
10070
+ }
10071
+
10051
10072
if (cc_resolved == .Inline and is_noinline) {
10052
10073
return sema.fail(block, cc_src, "'noinline' function cannot have callconv 'Inline'", .{});
10053
10074
}
0 commit comments