From a58061464ea339d32448d5a2f224c1295a7fbb5b Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Fri, 30 Nov 2012 12:11:36 +0100 Subject: [PATCH] actually removing -Wmissing-return-values from parser.c and enabling the ast code for it --- ast.c | 5 +++-- parser.c | 11 ----------- 2 files changed, 3 insertions(+), 13 deletions(-) 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); } -- 2.39.2