Don't append return to void procedures
This commit is contained in:
		| @@ -160,16 +160,13 @@ namespace gcc | ||||
|  | ||||
|         this->symbol_map->enter(definition->identifier(), source::make_info(this->main_fndecl)); | ||||
|  | ||||
|         tree resdecl = build_decl(UNKNOWN_LOCATION, RESULT_DECL, NULL_TREE, integer_type_node); | ||||
|         tree resdecl = build_decl(UNKNOWN_LOCATION, RESULT_DECL, | ||||
|                 NULL_TREE, TREE_TYPE(TREE_TYPE(this->main_fndecl))); | ||||
|         DECL_CONTEXT(resdecl) = this->main_fndecl; | ||||
|         DECL_RESULT(this->main_fndecl) = resdecl; | ||||
|         tree set_result = build2(INIT_EXPR, void_type_node, DECL_RESULT(main_fndecl), | ||||
|                 build_int_cst_type(integer_type_node, 0)); | ||||
|         tree return_stmt = build1(RETURN_EXPR, void_type_node, set_result); | ||||
|  | ||||
|         enter_scope(); | ||||
|         definition->body().accept(this); | ||||
|         append_to_statement_list(return_stmt, &this->current_statements); | ||||
|  | ||||
|         tree_symbol_mapping mapping = leave_scope(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user