Print this page
new smatch
@@ -42,10 +42,11 @@
static char *cur_func;
static unsigned int loop_count;
static int last_goto_statement_handled;
int __expr_stmt_count;
int __in_function_def;
+int __in_unmatched_hook;
static struct expression_list *switch_expr_stack = NULL;
static struct expression_list *post_op_stack = NULL;
static struct ptr_list *backup;
@@ -458,10 +459,12 @@
else
__pass_to_client(expr, ASSIGNMENT_HOOK);
__fake_struct_member_assignments(expr);
+ /* Re-examine ->right for inlines. See the commit message */
+ right = strip_expr(expr->right);
if (expr->op == '=' && right->type == EXPR_CALL)
__pass_to_client(expr, CALL_ASSIGNMENT_HOOK);
if (get_macro_name(right->pos) &&
get_macro_name(expr->pos) != get_macro_name(right->pos))
@@ -525,12 +528,12 @@
if (sym_name_is("__builtin_constant_p", expr->fn))
break;
if (handle__builtin_choose_expr(expr))
break;
- split_expr_list(expr->args, expr);
__split_expr(expr->fn);
+ split_expr_list(expr->args, expr);
if (is_inline_func(expr->fn))
add_inline_function(expr->fn->symbol);
if (inlinable(expr->fn))
__inline_call = 1;
__process_post_op_stack();
@@ -567,10 +570,11 @@
__pass_to_client(expr, STRING_HOOK);
break;
default:
break;
};
+ __pass_to_client(expr, EXPR_HOOK_AFTER);
pop_expression(&big_expression_stack);
}
static int is_forever_loop(struct statement *stmt)
{
@@ -698,11 +702,11 @@
__push_continues();
__push_breaks();
__merge_gotos(loop_name, NULL);
__split_stmt(stmt->iterator_statement);
__merge_continues();
- if (!is_zero(stmt->iterator_post_condition))
+ if (!expr_is_zero(stmt->iterator_post_condition))
__save_gotos(loop_name, NULL);
if (is_forever_loop(stmt)) {
__use_breaks();
} else {
@@ -1612,25 +1616,24 @@
__bail_on_rest_of_function = 0;
}
static void save_flow_state(void)
{
- __add_ptr_list(&backup, INT_PTR(loop_num << 2), 0);
- __add_ptr_list(&backup, INT_PTR(loop_count << 2), 0);
- __add_ptr_list(&backup, INT_PTR(final_pass << 2), 0);
+ __add_ptr_list(&backup, INT_PTR(loop_num << 2));
+ __add_ptr_list(&backup, INT_PTR(loop_count << 2));
+ __add_ptr_list(&backup, INT_PTR(final_pass << 2));
- __add_ptr_list(&backup, big_statement_stack, 0);
- __add_ptr_list(&backup, big_expression_stack, 0);
- __add_ptr_list(&backup, big_condition_stack, 0);
- __add_ptr_list(&backup, switch_expr_stack, 0);
+ __add_ptr_list(&backup, big_statement_stack);
+ __add_ptr_list(&backup, big_expression_stack);
+ __add_ptr_list(&backup, big_condition_stack);
+ __add_ptr_list(&backup, switch_expr_stack);
- __add_ptr_list(&backup, cur_func_sym, 0);
+ __add_ptr_list(&backup, cur_func_sym);
- __add_ptr_list(&backup, __prev_stmt, 0);
- __add_ptr_list(&backup, __cur_stmt, 0);
- __add_ptr_list(&backup, __next_stmt, 0);
-
+ __add_ptr_list(&backup, __prev_stmt);
+ __add_ptr_list(&backup, __cur_stmt);
+ __add_ptr_list(&backup, __next_stmt);
}
static void *pop_backup(void)
{
void *ret;