From: Wolfgang (Blub) Bumiller Date: Fri, 30 Nov 2012 11:11:36 +0000 (+0100) Subject: actually removing -Wmissing-return-values from parser.c and enabling the ast code... X-Git-Tag: 0.1.9~194 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a58061464ea339d32448d5a2f224c1295a7fbb5b;p=xonotic%2Fgmqcc.git actually removing -Wmissing-return-values from parser.c and enabling the ast code for it --- diff --git a/ast.c b/ast.c index 188dcec..604e6a0 100644 --- a/ast.c +++ b/ast.c @@ -1446,14 +1446,15 @@ 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 (!self->vtype->expression.next || self->vtype->expression.next->expression.vtype == TYPE_VOID) { return ir_block_create_return(self->curblock, NULL); } - else + else if (vec_size(self->curblock->entries)) { /* error("missing return"); */ if (compile_warning(ast_ctx(self), WARN_MISSING_RETURN_VALUES, diff --git a/parser.c b/parser.c index c771dd6..0c25a23 100644 --- a/parser.c +++ b/parser.c @@ -2514,17 +2514,6 @@ static bool parse_block_into(parser_t *parser, ast_block *block, bool warnreturn if (parser->tok != '}') { block = NULL; } else { - if (warnreturn && parser->function->vtype->expression.next->expression.vtype != TYPE_VOID) - { - if (!vec_size(block->exprs) || - !ast_istype(vec_last(block->exprs), ast_return)) - { - if (parsewarning(parser, WARN_MISSING_RETURN_VALUES, "control reaches end of non-void function")) { - block = NULL; - goto cleanup; - } - } - } (void)parser_next(parser); }