From: Dan Carpenter Date: Fri, 8 Feb 2013 22:43:05 +0000 (+0300) Subject: silence bogus "unreachable code" warnings X-Git-Tag: 1.57 X-Git-Url: https://repo.or.cz/w/smatch.git/commitdiff_plain/e39ef3260db4dcb75b5d57c97186ff1e8c01269d silence bogus "unreachable code" warnings No return functions were triggering "unreachable code" warnings even though there was no code after the function call. I wasn't seeing these because I use always the --spammy option and the unreachable code warning for --spammy is in a different spot. Reported-by: Bart Van Assche Signed-off-by: Dan Carpenter --- diff --git a/smatch_function_hooks.c b/smatch_function_hooks.c index 2e4b43d4..2b59a07d 100644 --- a/smatch_function_hooks.c +++ b/smatch_function_hooks.c @@ -625,6 +625,8 @@ static void db_return_states(struct expression *expr) if (expr->fn->type != EXPR_SYMBOL || !expr->fn->symbol) return; + if (!__get_cur_slist()) /* no return functions */ + return; sym = expr->fn->symbol; if (!sym)