From cfb887c1a4f8883b6ada34d9a1ba28a2769b9950 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Fri, 9 Nov 2012 15:37:13 +0300 Subject: [PATCH] sval: extra: count pointer types as equivalent For the purposes of smatch_extra.c all pointer types are similar enough to be equivalent here. Signed-off-by: Dan Carpenter --- smatch_extra.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/smatch_extra.c b/smatch_extra.c index 60a0dc60..fbf0c053 100644 --- a/smatch_extra.c +++ b/smatch_extra.c @@ -395,6 +395,15 @@ static void match_function_call(struct expression *expr) } END_FOR_EACH_PTR(arg); } +static int types_equiv_or_pointer(struct symbol *one, struct symbol *two) +{ + if (!one || !two) + return 0; + if (one->type == SYM_PTR && two->type == SYM_PTR) + return 1; + return types_equiv(one, two); +} + static void match_assign(struct expression *expr) { struct range_list_sval *rl = NULL; @@ -424,7 +433,7 @@ static void match_assign(struct expression *expr) right_name = get_variable_from_expr(right, &right_sym); if (expr->op == '=' && right_name && right_sym && - types_equiv(get_type(expr->left), get_type(expr->right))) { + types_equiv_or_pointer(get_type(expr->left), get_type(expr->right))) { set_equiv(left, right); goto free; } -- 2.11.4.GIT