From: Wolfgang Bumiller Date: Mon, 14 Jan 2013 09:56:56 +0000 (+0100) Subject: fix: missing-return check: vec_size(entries) is 0 on the entry-block, also check... X-Git-Tag: before-library~264 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d7f4e981a30768d99907621f5eb392339193833d;p=xonotic%2Fgmqcc.git fix: missing-return check: vec_size(entries) is 0 on the entry-block, also check if it's the first block --- 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,