Add (gen > c) -> Added callconv attribute for function

pull/14027/head
Shib 2022-04-13 12:01:55 +02:00
parent d7adb67d52
commit 6d12f57d14
2 changed files with 18 additions and 0 deletions

View File

@ -2153,6 +2153,11 @@ fn (mut g Gen) write_fn_attrs(attrs []ast.Attr) string {
'_fastcall' { '_fastcall' {
fn_attrs += '__fastcall ' fn_attrs += '__fastcall '
} }
"callconv" {
if attr.has_arg {
fn_attrs += '__$attr.arg '
}
}
'console' { 'console' {
g.force_main_console = true g.force_main_console = true
} }

View File

@ -197,6 +197,19 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
'c2v_variadic' { is_c2v_variadic = true } 'c2v_variadic' { is_c2v_variadic = true }
'use_new' { is_ctor_new = true } 'use_new' { is_ctor_new = true }
'markused' { is_markused = true } 'markused' { is_markused = true }
"windows_stdcall" {
p.warn_with_pos('windows_stdcall has been deprecated, it will be an error soon', p.tok.pos())
}
"_fastcall" {
p.warn_with_pos('_fastcall has been deprecated, it will be an error soon', p.tok.pos())
}
"callconv" {
if fna.has_arg {
if fna.arg !in ['stdcall', 'fastcall', 'cdecl'] {
p.error_with_pos('unsupported calling convention, supported are stdcall, fastcall and cdecl', p.tok.pos())
}
}
}
else {} else {}
} }
} }