From 09d42ab0ffff0b8d49d6b29d35c69815c944bbe7 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Mon, 18 Jun 2012 17:32:38 +0300 Subject: [PATCH] flow: handle the __noreturn__ attribute No return functions should nullify the path. Smatch already has smatch_data/no_return_funcs but it would be better to remove that and handle everything automatically. Reported-by: KOSAKI Motohiro Signed-off-by: Dan Carpenter --- smatch_flow.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/smatch_flow.c b/smatch_flow.c index cedf768e..c99361ed 100644 --- a/smatch_flow.c +++ b/smatch_flow.c @@ -91,6 +91,15 @@ static int is_inline_func(struct expression *expr) return 0; } +static int is_noreturn_func(struct expression *expr) +{ + if (expr->type != EXPR_SYMBOL || !expr->symbol) + return 0; + if (expr->symbol->ctype.modifiers & MOD_NORETURN) + return 1; + return 0; +} + void __split_expr(struct expression *expr) { if (!expr) @@ -199,6 +208,8 @@ void __split_expr(struct expression *expr) if (is_inline_func(expr->fn)) add_inline_function(expr->fn->symbol); __pass_to_client(expr, FUNCTION_CALL_HOOK); + if (is_noreturn_func(expr->fn)) + nullify_path(); break; case EXPR_INITIALIZER: split_expr_list(expr->expr_list); -- 2.11.4.GIT