From: Markus Elfring <Markus.Elfring@web.de>
To: cocci@inria.fr
Cc: Yue Haibing <yuehaibing@huawei.com>
Subject: [cocci] Deleting duplicate condition checks (with SmPL)?
Date: Sun, 13 Jul 2025 09:21:20 +0200 [thread overview]
Message-ID: <89cd029d-b68d-4d9d-92da-ff2ee2bcbe10@web.de> (raw)
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
next reply other threads:[~2025-07-13 7:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-13 7:21 Markus Elfring [this message]
2025-07-14 7:26 ` [cocci] Deleting duplicate condition checks (with SmPL)? 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=89cd029d-b68d-4d9d-92da-ff2ee2bcbe10@web.de \
--to=markus.elfring@web.de \
--cc=cocci@inria.fr \
--cc=yuehaibing@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox