]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
print a proper error message when a function lacks a body
authorWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 16 Aug 2012 13:31:46 +0000 (15:31 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Thu, 16 Aug 2012 13:31:46 +0000 (15:31 +0200)
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;
         }
     }