@@ -2052,6 +2052,7 @@ finish_function_contracts (tree fndecl)
DECL_PENDING_INLINE_P (pre) = false;
start_preparsed_function (pre, DECL_ATTRIBUTES (pre), flags);
remap_and_emit_conditions (fndecl, pre, PRECONDITION_STMT);
+ finish_return_stmt (NULL_TREE);
tree finished_pre = finish_function (false);
expand_or_defer_fn (finished_pre);
}
@@ -2065,6 +2066,8 @@ finish_function_contracts (tree fndecl)
remap_and_emit_conditions (fndecl, post, POSTCONDITION_STMT);
if (!VOID_TYPE_P (TREE_TYPE (TREE_TYPE (post))))
finish_return_stmt (get_postcondition_result_parameter (fndecl));
+ else
+ finish_return_stmt (NULL_TREE);
tree finished_post = finish_function (false);
expand_or_defer_fn (finished_post);
This is a minor tidy-up, tested on x86_64-darwin, OK For trunk? thanks Iain --- 8< --- At present, for pre-conditions and for post-conditions with a void return, we are not emitting a return statement. This patch adds the relevant return statements. gcc/cp/ChangeLog: * contracts.cc (finish_function_contracts): Add return statements to pre-condition and void post-cndition checking functions. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> --- gcc/cp/contracts.cc | 3 +++ 1 file changed, 3 insertions(+)