db: take static vs global into consideration wit function pointers
[smatch.git] / check_no_return.c
blob5cf76789b84dd8cf65cda7e626fd51710c9aa004
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 (is_reachable())
18 returned = 1;
21 static void match_func_end(struct symbol *sym)
23 if (!is_reachable() && !returned)
24 sm_info("info: add to no_return_funcs");
25 returned = 0;
28 void check_no_return(int id)
30 if (!option_info)
31 return;
32 my_id = id;
33 add_hook(&match_return, RETURN_HOOK);
34 add_hook(&match_func_end, END_FUNC_HOOK);