From 38857318692acd02353b47129bb06326528a47c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9my=20LEFAURE?= Date: Fri, 1 Jul 2022 16:01:36 +0000 Subject: [PATCH] coccinelle: Extend address test from ifaddr semantic patch to test expressions MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Julia Lawall --- scripts/coccinelle/misc/{ifaddr.cocci => test_addr.cocci} | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) rename scripts/coccinelle/misc/{ifaddr.cocci => test_addr.cocci} (94%) diff --git a/scripts/coccinelle/misc/ifaddr.cocci b/scripts/coccinelle/misc/test_addr.cocci similarity index 94% rename from scripts/coccinelle/misc/ifaddr.cocci rename to scripts/coccinelle/misc/test_addr.cocci index fc92e8f..029db90 100644 --- a/scripts/coccinelle/misc/ifaddr.cocci +++ b/scripts/coccinelle/misc/test_addr.cocci @@ -14,12 +14,10 @@ virtual context @r@ expression x; -statement S1,S2; position p; @@ -*if@p (&x) - S1 else S2 +*\(&x@p == NULL \| &x@p != NULL\) @script:python depends on org@ p << r.p; -- 2.7.4