]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
fix: missing-return check: vec_size(entries) is 0 on the entry-block, also check...
authorWolfgang Bumiller <blub@speed.at>
Mon, 14 Jan 2013 09:56:56 +0000 (10:56 +0100)
committerWolfgang Bumiller <blub@speed.at>
Mon, 14 Jan 2013 09:56:56 +0000 (10:56 +0100)
ast.c

diff --git a/ast.c b/ast.c
index dbb2012f383bffa9ab6ef2654cd9516a813ca0f1..be8ce2e5aae7c14c7a12a55d4d34dfa3d242245c 100644 (file)
--- 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,