Fix get_value() for ((unsigned int) -1)
[smatch.git] / check_no_return.c
blob8c2e98c57210f042d1bac1c4f1a23d91744cda0b
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 int function_is_static()
23 if (cur_func_sym->ctype.modifiers & MOD_STATIC)
24 return 1;
25 return 0;
28 static void match_func_end(struct symbol *sym)
30 if (!function_is_static() && !is_reachable() && !returned)
31 sm_info("info: add to no_return_funcs");
32 returned = 0;
35 void check_no_return(int id)
37 if (!option_info)
38 return;
39 my_id = id;
40 add_hook(&match_return, RETURN_HOOK);
41 add_hook(&match_func_end, END_FUNC_HOOK);