]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Don't have the ast's codegen error on missing returns
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 19 Aug 2012 18:28:14 +0000 (20:28 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 19 Aug 2012 18:28:14 +0000 (20:28 +0200)
ast.c

diff --git a/ast.c b/ast.c
index 7c349b4638657b2cfa52dbe8866479dcf4e65199..67306a13cec6e935fbe030ff51a5247165a9eff3 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -934,6 +934,9 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
     /* TODO: check return types */
     if (!self->curblock->is_return)
     {
+        return ir_block_create_return(self->curblock, NULL);
+        /* From now on the parser has to handle this situation */
+#if 0
         if (!self->vtype->expression.next ||
             self->vtype->expression.next->expression.vtype == TYPE_VOID)
         {
@@ -945,6 +948,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
             asterror(ast_ctx(self), "function `%s` missing return value", self->name);
             return false;
         }
+#endif
     }
     return true;
 }