mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2024-11-30 15:41:12 +00:00
fix: missing-return check: vec_size(entries) is 0 on the entry-block, also check if it's the first block
This commit is contained in:
parent
bec05f1bbb
commit
d7f4e981a3
1 changed files with 2 additions and 2 deletions
4
ast.c
4
ast.c
|
@ -1599,7 +1599,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
|
|||
return false;
|
||||
}
|
||||
|
||||
self->curblock = ir_function_create_block(ast_ctx(self), irf, "entry");
|
||||
irf->first = self->curblock = ir_function_create_block(ast_ctx(self), irf, "entry");
|
||||
if (!self->curblock) {
|
||||
compile_error(ast_ctx(self), "failed to allocate entry block for `%s`", self->name);
|
||||
return false;
|
||||
|
@ -1633,7 +1633,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
|
|||
{
|
||||
return ir_block_create_return(self->curblock, ast_ctx(self), NULL);
|
||||
}
|
||||
else if (vec_size(self->curblock->entries))
|
||||
else if (vec_size(self->curblock->entries) || self->curblock == irf->first)
|
||||
{
|
||||
/* error("missing return"); */
|
||||
if (compile_warning(ast_ctx(self), WARN_MISSING_RETURN_VALUES,
|
||||
|
|
Loading…
Reference in a new issue