mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-27 06:02:22 +00:00
print a proper error message when a function lacks a body
This commit is contained in:
parent
ec439d7880
commit
98567e20f3
1 changed files with 6 additions and 0 deletions
6
ast.c
6
ast.c
|
@ -846,6 +846,11 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
|
|||
return true;
|
||||
}
|
||||
|
||||
if (!self->blocks_count) {
|
||||
asterror(ast_ctx(self), "function `%s` has no body", self->name);
|
||||
return false;
|
||||
}
|
||||
|
||||
self->curblock = ir_function_create_block(irf, "entry");
|
||||
if (!self->curblock)
|
||||
return false;
|
||||
|
@ -867,6 +872,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
|
|||
else
|
||||
{
|
||||
/* error("missing return"); */
|
||||
asterror(ast_ctx(self), "function `%s` missing return value", self->name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue