flow: hooks: fix MACRO_ASSIGNMENT_HOOK
authorDan Carpenter <dan.carpenter@oracle.com>
Sat, 17 Nov 2012 13:42:14 +0000 (17 16:42 +0300)
committerDan Carpenter <dan.carpenter@oracle.com>
Sat, 17 Nov 2012 13:42:14 +0000 (17 16:42 +0300)
The old logic passed the assignment if an assignment took place inside a
macro.  What we want are places where a macro is assigned to a variable.

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

index e2d8cfc..2ede12e 100644 (file)
@@ -158,7 +158,8 @@ void __split_expr(struct expression *expr)
                tmp = strip_expr(expr->right);
                if (tmp->type == EXPR_CALL)
                        __pass_to_client(expr, CALL_ASSIGNMENT_HOOK);
-               if (get_macro_name(tmp->pos))
+               if (get_macro_name(tmp->pos) &&
+                   get_macro_name(expr->pos) != get_macro_name(tmp->pos))
                        __pass_to_client(expr, MACRO_ASSIGNMENT_HOOK);
                __split_expr(expr->left);
                break;