cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [cocci] [PATCH v3] coccinelle: Extend address test from ifaddr to every test expression
@ 2022-06-10 11:18 Jérémy LEFAURE
  2022-06-10 17:36 ` Markus Elfring
  2022-06-16  6:32 ` Markus Elfring
  0 siblings, 2 replies; 13+ messages in thread
From: Jérémy LEFAURE @ 2022-06-10 11:18 UTC (permalink / raw)
  To: Julia Lawall, Nicolas Palix, Markus Elfring; +Cc: cocci, kernel-janitors

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
for every test expression.

Signed-off-by: Jérémy Lefaure <jeremy.lefaure@netatmo.com>
---
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..2d0ec86d1701 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 || ...
 
 @script:python depends on org@
 p << r.p;
-- 
2.25.1

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

end of thread, other threads:[~2022-06-25 12:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 11:18 [cocci] [PATCH v3] coccinelle: Extend address test from ifaddr to every test expression Jérémy LEFAURE
2022-06-10 17:36 ` Markus Elfring
2022-06-10 17:42   ` Julia Lawall
2022-06-10 18:05     ` [cocci] " Markus Elfring
2022-06-13 16:25   ` [cocci] [PATCH v3] " Jérémy LEFAURE
2022-06-13 18:11     ` Julia Lawall
2022-06-13 19:08     ` Markus Elfring
2022-06-16  6:32 ` Markus Elfring
2022-06-21 16:10   ` Jérémy LEFAURE
2022-06-21 17:16     ` [cocci] " Markus Elfring
2022-06-23 16:17       ` Jérémy LEFAURE
2022-06-23 19:35         ` Markus Elfring
2022-06-21 19:42     ` [cocci] [PATCH v3] " Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).