From d7f4e981a30768d99907621f5eb392339193833d Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Mon, 14 Jan 2013 10:56:56 +0100 Subject: [PATCH] fix: missing-return check: vec_size(entries) is 0 on the entry-block, also check if it's the first block --- ast.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ast.c b/ast.c index dbb2012..be8ce2e 100644 --- a/ast.c +++ b/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,