Add @(entry_point_only) for procedures

This commit is contained in:
gingerBill
2024-01-05 13:38:30 +00:00
parent 70c5153471
commit 2820bbc269
5 changed files with 14 additions and 0 deletions

View File

@@ -7195,6 +7195,14 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c
}
}
add_entity_use(c, operand->expr, initial_entity);
if (initial_entity->Procedure.entry_point_only) {
if (c->curr_proc_decl && c->curr_proc_decl->entity == c->info->entry_point) {
// Okay
} else {
error(operand->expr, "Procedures with the attribute '@(entry_point_only)' can only be called directly from the user-level entry point procedure");
}
}
}
if (operand->mode != Addressing_ProcGroup) {