flow: save and restore the big_expression_stack when processing inlines
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Mar 2013 12:33:31 +0000 (14 15:33 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Thu, 14 Mar 2013 12:33:31 +0000 (14 15:33 +0300)
This was a simple over sight.  It causes a bug when we look at the big
expression stack to see if a function call is assigned to something.  It
means we query the database twice.

I don't know if this affects any of the shipping Smatch checks but querying
the database twice affects one of my checks that I haven't pushed yet.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch_flow.c

index 1bbffc2..401e599 100644 (file)
@@ -877,6 +877,7 @@ static void parse_inline(struct expression *call)
        int final_pass_bak = final_pass;
        char *cur_func_bak = cur_func;
        struct statement_list *big_statement_stack_bak = big_statement_stack;
+       struct expression_list *big_expression_stack_bak = big_expression_stack;
        struct expression_list *switch_expr_stack_bak = switch_expr_stack;
        struct symbol *cur_func_sym_bak = cur_func_sym;
 
@@ -896,6 +897,7 @@ static void parse_inline(struct expression *call)
        save_all_states();
        nullify_all_states();
        big_statement_stack = NULL;
+       big_expression_stack = NULL;
        switch_expr_stack = NULL;
 
        __unnullify_path();
@@ -915,6 +917,7 @@ static void parse_inline(struct expression *call)
        cur_func_sym = cur_func_sym_bak;
        cur_func = cur_func_bak;
        big_statement_stack = big_statement_stack_bak;
+       big_expression_stack = big_expression_stack_bak;
        switch_expr_stack = switch_expr_stack_bak;
 
        restore_all_states();