Sema: infrastructure for supporting more than .C callconv for variadic functions

Now you can add new calling conventions that you confirmed to work with
variadic functions simply in a single place and the rest will work
automatically.
This commit is contained in:
r00ster91
2023-07-08 18:05:03 -04:00
parent 9be1a3f7ef
commit 026c63d8fe
3 changed files with 49 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
fn foo(...) void {}
fn bar(a: anytype, ...) callconv(a) void {}
inline fn foo2(...) void {}
comptime {
_ = foo;
@@ -7,10 +8,16 @@ comptime {
comptime {
_ = bar;
}
comptime {
_ = foo2;
}
// error
// backend=stage2
// target=native
//
// :1:1: error: variadic function must have 'C' calling convention
// :1:1: error: variadic function does not support '.Unspecified' calling convention
// :1:1: note: supported calling conventions: '.C'
// :2:1: error: generic function cannot be variadic
// :1:1: error: variadic function does not support '.Inline' calling convention
// :1:1: note: supported calling conventions: '.C'