silence bogus "unreachable code" warnings1.571.58
authorDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Feb 2013 22:43:05 +0000 (9 01:43 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Fri, 8 Feb 2013 22:43:05 +0000 (9 01:43 +0300)
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 <bvanassche@acm.org>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_function_hooks.c

index 2e4b43d..2b59a07 100644 (file)
@@ -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)