From 8fc70ec8be8a62f246ae12f406288304ac94f27a Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Mon, 2 Jun 2008 11:13:50 +0000 Subject: [PATCH] warn if missing return [r19921] --- ast2firm.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ast2firm.c b/ast2firm.c index e48a92f..8830e7b 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -4513,6 +4513,9 @@ static void leave_statement_to_firm(leave_statement_t *statement) { errorf(&statement->base.source_position, "__leave not supported yet"); } +/** + * Transform a statement. + */ static void statement_to_firm(statement_t *statement) { #ifndef NDEBUG @@ -4898,6 +4901,9 @@ static void handle_decl_modifier_irg(ir_graph_ptr irg, decl_modifiers_t decl_mod } } +/** + * Create code for a function. + */ static void create_function(declaration_t *declaration) { ir_entity *function_entity = get_function_entity(declaration); @@ -4958,6 +4964,9 @@ static void create_function(declaration_t *declaration) in[0] = new_Const(mode, get_mode_null(mode)); } else { in[0] = new_Unknown(mode); + warningf(&declaration->source_position, "missing return statement at end of non-void function '%Y'", + declaration->symbol); + } ret = new_Return(get_store(), 1, in); } -- 2.20.1