From: Wolfgang (Blub) Bumiller Date: Thu, 16 Aug 2012 13:31:46 +0000 (+0200) Subject: print a proper error message when a function lacks a body X-Git-Tag: 0.1-rc1~251 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=98567e20f31f4d095320269dc166c904cd3ad67a;p=xonotic%2Fgmqcc.git print a proper error message when a function lacks a body --- diff --git a/ast.c b/ast.c index 41a53f0..d8bd293 100644 --- 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; } }