]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.c
CALL instructions need to offset the st++ too
[xonotic/gmqcc.git] / ast.c
diff --git a/ast.c b/ast.c
index 41a53f0bc8a76b626f3a4b4db68004c89189c6e6..d8bd293d451b5e6671a495ec188190c004055237 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -846,6 +846,11 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
         return true;
     }
 
+    if (!self->blocks_count) {
+        asterror(ast_ctx(self), "function `%s` has no body", self->name);
+        return false;
+    }
+
     self->curblock = ir_function_create_block(irf, "entry");
     if (!self->curblock)
         return false;
@@ -867,6 +872,7 @@ bool ast_function_codegen(ast_function *self, ir_builder *ir)
         else
         {
             /* error("missing return"); */
+            asterror(ast_ctx(self), "function `%s` missing return value", self->name);
             return false;
         }
     }