/* 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,
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);
}