2 * smatch/check_db_info.c
4 * Copyright (C) 2010 Dan Carpenter.
6 * Licensed under the Open Software License version 1.1
11 #include "smatch_extra.h"
15 static void match_return(struct expression
*ret_value
)
17 struct smatch_state
*state
;
18 struct range_list
*rl
;
21 ret_value
= strip_expr(ret_value
);
25 if (ret_value
->type
== EXPR_CALL
) {
26 rl
= db_return_vals(ret_value
);
28 sm_msg("info: return_value %s", show_ranges(rl
));
30 sm_msg("info: return_value unknown");
34 if (get_value(ret_value
, &val
)) {
35 sm_msg("info: return_value %lld", val
);
38 state
= get_state_expr(SMATCH_EXTRA
, ret_value
);
40 sm_msg("info: return_value unknown");
44 sm_msg("info: return_value %s", state
->name
);
47 void check_db_info(int id
)
52 add_hook(&match_return
, RETURN_HOOK
);