From 604579b73e9653e34489b266f685cc3aed65b011 Mon Sep 17 00:00:00 2001 From: Dan Carpenter Date: Tue, 22 May 2012 20:45:49 +0300 Subject: [PATCH] or_vs_and: ignore *p++ || *p++ Silence some false positives. Signed-off-by: Dan Carpenter --- check_or_vs_and.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/check_or_vs_and.c b/check_or_vs_and.c index 0db557cb..b885b41d 100644 --- a/check_or_vs_and.c +++ b/check_or_vs_and.c @@ -11,6 +11,16 @@ static int my_id; +static int does_inc_dec(struct expression *expr) +{ + if (expr->type == EXPR_PREOP || expr->type == EXPR_POSTOP) { + if (expr->op == SPECIAL_INCREMENT || expr->op == SPECIAL_DECREMENT) + return 1; + return does_inc_dec(expr->unop); + } + return 0; +} + static int expr_equiv(struct expression *one, struct expression *two) { struct symbol *one_sym, *two_sym; @@ -18,6 +28,9 @@ static int expr_equiv(struct expression *one, struct expression *two) char *two_name = NULL; int ret = 0; + if (does_inc_dec(one) || does_inc_dec(two)) + return 0; + one_name = get_variable_from_expr_complex(one, &one_sym); if (!one_name || !one_sym) goto free; -- 2.11.4.GIT