public inbox for cocci@systeme.lip6.fr
 help / color / mirror / Atom feed
* [cocci] Deleting duplicate condition checks (with SmPL)?
@ 2025-07-13  7:21 Markus Elfring
  2025-07-14  7:26 ` Markus Elfring
  2025-07-14  9:54 ` Julia Lawall
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Elfring @ 2025-07-13  7:21 UTC (permalink / raw)
  To: cocci; +Cc: Yue Haibing

Hello,

I noticed another contribution.

I got into the mood to construct another script for the semantic patch language.


// See also:
// [PATCH net-next] ipv6: mcast: Remove unnecessary null check in mld_del_delrec()
// https://lore.kernel.org/lkml/20250712092811.2992283-1-yuehaibing@huawei.com/
//
// https://elixir.bootlin.com/linux/v6.16-rc5/source/net/ipv6/mcast.c#L786-L813
@deletions@
expression x;
@@
 if (x)
 {
 <+...
-}
-if (x)
-{
 ...+>
 }


Questionable test result (by the software combination “Coccinelle 1.3.0” for example):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/janitor> /usr/bin/spatch --parse-cocci delete_duplicate_condition_checks2.cocci
…
minus: parse error: 
  File "delete_duplicate_condition_checks2.cocci", line 12, column 1, charpos = 307
  around = '}',
  whole content = -}


The transformation approach is working as expected if the specification “... when any”
would be applied instead of the SmPL nest construct.
Which software improvements will become more desirable for such an use case?

Regards,
Markus

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

end of thread, other threads:[~2025-07-14 11:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-13  7:21 [cocci] Deleting duplicate condition checks (with SmPL)? Markus Elfring
2025-07-14  7:26 ` Markus Elfring
2025-07-14  9:57   ` Julia Lawall
2025-07-14 11:13     ` Markus Elfring
2025-07-14 11:28       ` Julia Lawall
2025-07-14 11:33         ` Markus Elfring
2025-07-14  9:54 ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox