cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] How to match switch cases and their absence with coccinelle?
@ 2021-01-12 15:03 Denis Efremov
  2021-01-12 16:13 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Denis Efremov @ 2021-01-12 15:03 UTC (permalink / raw)
  To: Coccinelle

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

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

end of thread, other threads:[~2021-01-12 17:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-12 15:03 [Cocci] How to match switch cases and their absence with coccinelle? Denis Efremov
2021-01-12 16:13 ` Julia Lawall
2021-01-12 17:03   ` Denis Efremov
2021-01-12 17:06     ` 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).