diff options
| author | gingerBill <bill@gingerbill.org> | 2023-06-06 11:12:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2023-06-06 11:12:14 +0100 |
| commit | 24ed07b6d563373b2185196447f9afe2a9831483 (patch) | |
| tree | 94d35dcd2ef6fe09cf4a22265252206c2db7aedd /src/checker.cpp | |
| parent | ecad7309453c8f6471b820a643e7676e1a71800f (diff) | |
Add error requiring an explicit calling convention for foreign procedures
Diffstat (limited to 'src/checker.cpp')
| -rw-r--r-- | src/checker.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/checker.cpp b/src/checker.cpp index a25d85fb8..49f2c4bb4 100644 --- a/src/checker.cpp +++ b/src/checker.cpp @@ -3889,6 +3889,14 @@ gb_internal void check_collect_value_decl(CheckerContext *c, Ast *decl) { GB_ASSERT(pl->type->kind == Ast_ProcType); auto cc = pl->type->ProcType.calling_convention; if (cc == ProcCC_ForeignBlockDefault) { + if (is_arch_wasm()) { + begin_error_block(); + error(init, "For wasm related targets, it is required that you either define the" + " @(default_calling_convention=<string>) on the foreign block or" + " explicitly assign it on the procedure signature"); + error_line("\tSuggestion: when dealing with normal Odin code (e.g. js_wasm32), use \"contextless\"; when dealing with Emscripten like code, use \"c\"\n"); + end_error_block(); + } cc = ProcCC_CDecl; if (c->foreign_context.default_cc > 0) { cc = c->foreign_context.default_cc; |