actually removing -Wmissing-return-values from parser.c and enabling the ast code for it

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-30 12:11:36 +01:00
parent 2ec0a96a21
commit a58061464e
2 changed files with 3 additions and 13 deletions

5
ast.c
View file

@ -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,

View file

@ -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);
}