All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] [PATCH v5] coccinelle: Extend address test from ifaddr semantic patch to test expressions
@ 2022-07-01 16:01 Jérémy LEFAURE
  2022-07-01 16:55 ` Markus Elfring
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Jérémy LEFAURE @ 2022-07-01 16:01 UTC (permalink / raw)
  To: Julia Lawall, Nicolas Palix; +Cc: cocci, Markus Elfring

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>
---
v4 -> v5: Change semantic patch to match explicit tests to NULL +
improve commit message
v3 -> v4: Improve patch subject
v2 -> v3: Apply Julia's suggestion to have a more generic solution + adapt
commit message and file name to this new solution.
v1 -> v2: Moved disjunction on the condition itself instead of being on the
if statements.

 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 fc92e8fcbfcb..029db9069c44 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.25.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2022-07-09  5:31 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-01 16:01 [cocci] [PATCH v5] coccinelle: Extend address test from ifaddr semantic patch to test expressions Jérémy LEFAURE
2022-07-01 16:55 ` Markus Elfring
2022-07-01 19:30 ` Markus Elfring
2022-07-01 20:49   ` Julia Lawall
2022-07-01 20:49     ` [cocci] " Julia Lawall
2022-07-01 21:13     ` [cocci] [v5] " Markus Elfring
2022-07-02  8:01     ` [cocci] [PATCH v5] " Markus Elfring
2022-07-02 10:21       ` Julia Lawall
2022-07-02 10:21         ` [cocci] " Julia Lawall
2022-07-02 11:00         ` [cocci] [v5] " Markus Elfring
2022-07-03 11:34         ` [cocci] [PATCH v5] " Markus Elfring
2022-07-03 10:50 ` Markus Elfring
2022-07-03 21:45 ` Julia Lawall
2022-07-04 17:16   ` [cocci] [v5] " Markus Elfring
2022-07-09  5:30   ` [cocci] [PATCH v5] " Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.