coccinelle: Extend address test from ifaddr semantic patch to test expressions

The test of an expression's address does not necessarily represent the
whole condition, it may only be a part of it. Also, an expression's
address is likely to be non-zero in every test expression, not only in
if statements.

This change aims at detecting an address test in more complex conditions
and not only in if statements.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@netatmo.com>
Signed-off-by: Julia Lawall <julia.lawall@inria.fr>
This commit is contained in:
Jérémy LEFAURE 2022-07-01 16:01:36 +00:00 committed by Julia Lawall
parent 20855e4cb3
commit 3885731869
1 changed files with 1 additions and 3 deletions

View File

@ -14,12 +14,10 @@ virtual context
@r@ @r@
expression x; expression x;
statement S1,S2;
position p; position p;
@@ @@
*if@p (&x) *\(&x@p == NULL \| &x@p != NULL\)
S1 else S2
@script:python depends on org@ @script:python depends on org@
p << r.p; p << r.p;