mirror of
https://github.com/odin-lang/Odin.git
synced 2026-07-22 23:42:33 +00:00
Odin_Calling_Convention defined in compiler; Allow for main :: proc "contextless" () {} with -bedrock; intrinsics.type_proc_calling_convention
This commit is contained in:
@@ -1527,10 +1527,26 @@ gb_internal void check_proc_decl(CheckerContext *ctx, Entity *e, DeclInfo *d) {
|
||||
error(e->token, "Procedure type of 'main' was expected to be 'proc()', got %s", str);
|
||||
gb_string_free(str);
|
||||
}
|
||||
if (pt->calling_convention != default_calling_convention()) {
|
||||
error(e->token, "Procedure 'main' cannot have a custom calling convention");
|
||||
if (build_context.bedrock) {
|
||||
switch (pt->calling_convention) {
|
||||
case ProcCC_Odin:
|
||||
case ProcCC_Contextless:
|
||||
// Okay
|
||||
break;
|
||||
default:
|
||||
error(e->token, "Procedure 'main' cannot have a custom calling convention beyond \"odin\" and \"contextless\" with '-bedrock'");
|
||||
pt->calling_convention = ProcCC_Odin;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
if (pt->calling_convention != default_calling_convention()) {
|
||||
error(e->token, "Procedure 'main' cannot have a custom calling convention");
|
||||
}
|
||||
pt->calling_convention = default_calling_convention();
|
||||
|
||||
}
|
||||
pt->calling_convention = default_calling_convention();
|
||||
|
||||
if (e->pkg->kind == Package_Init) {
|
||||
if (ctx->info->entry_point != nullptr) {
|
||||
error(e->token, "Redeclaration of the entry pointer procedure 'main'");
|
||||
|
||||
Reference in New Issue
Block a user