From: Denis Efremov <efremov@linux.com>
To: Coccinelle <cocci@systeme.lip6.fr>
Subject: [Cocci] How to match switch cases and their absence with coccinelle?
Date: Tue, 12 Jan 2021 18:03:22 +0300 [thread overview]
Message-ID: <9bd6a75e-c595-a623-de09-04d261263167@linux.com> (raw)
Hi,
Let's suppose I have this pattern:
@fix exists@
position p;
@@
binder_release_work(...)
{
...
switch (...) {
* case BINDER_WORK_NODE: ... break;@p
}
...
}
and I want to match binder_release_work() function in drivers/android/binder.c
file (linux kernel, master)
Seems like the rule is not enough, it gives nothing:
$ spatch --cocci-file binder.cocci drivers/android/binder.c
init_defs_builtins: /usr/lib64/coccinelle/standard.h
HANDLING: drivers/android/binder.c
1) What can I do to reliable check that there is a special case in a switch?
2) Is it possible to check that there is no case handling with something like:
switch (...) {
... when != case BINDER_WORK_NODE: ... break;
}
Thanks,
Denis
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next reply other threads:[~2021-01-12 15:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-12 15:03 Denis Efremov [this message]
2021-01-12 16:13 ` [Cocci] How to match switch cases and their absence with coccinelle? Julia Lawall
2021-01-12 17:03 ` Denis Efremov
2021-01-12 17:06 ` 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=9bd6a75e-c595-a623-de09-04d261263167@linux.com \
--to=efremov@linux.com \
--cc=cocci@systeme.lip6.fr \
/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 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.