db, extra, user_data: handle: *x = 1; return x;"
[smatch.git] / check_no_return.c
blobf4a31b01c825a301ef2d0e074d331483b588fe83
1 /*
2 * smatch/check_no_return.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
8 */
10 #include "smatch.h"
12 static int my_id;
13 static int returned;
15 static void match_return(struct expression *ret_value)
17 if (__inline_fn)
18 return;
19 if (is_reachable())
20 returned = 1;
23 static void match_func_end(struct symbol *sym)
25 if (__inline_fn)
26 return;
27 if (!is_reachable() && !returned)
28 sm_info("info: add to no_return_funcs");
29 returned = 0;
32 void check_no_return(int id)
34 if (!option_info)
35 return;
36 my_id = id;
37 add_hook(&match_return, RETURN_HOOK);
38 add_hook(&match_func_end, END_FUNC_HOOK);