All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] isomorphism with unlikely
@ 2013-05-20 17:34 Wolfram Sang
  2013-05-20 17:47 ` Lars-Peter Clausen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2013-05-20 17:34 UTC (permalink / raw)
  To: cocci

Hi,

using 1.0-rc16 from debian, I use the following semantic patch:

@@
expression r, p, n;
@@
	r = platform_get_resource(p, IORESOURCE_MEM, n);
	...
(
-	if (!r) { ... }
|
-	if (unlikely(!r)) { ... }
|
-	if (unlikely(r == NULL)) { ... }
)

and running against the latest kernel tree (~3.10-rc1):

spatch --sp-file unlikely_iso.cocci ~/Kernel/linux/drivers/net/ethernet/renesas/sh_eth.c

gives me a match:

-	if (unlikely(res == NULL)) {
...

Note that I have two alternations with 'unlikely' because using '!r'
alone will not give me a match. I guess the isomorphism is skipped for
some reason when used as an argument of unlikely. If so, is it possible
to enforce it somehow? Or would it be even better to make 'unlikely' an
isomorphism itself, so that the semantic patch doesn't need to know
anything about 'unlikely'?

Thanks,

   Wolfram

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

end of thread, other threads:[~2013-05-26 20:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-20 17:34 [Cocci] isomorphism with unlikely Wolfram Sang
2013-05-20 17:47 ` Lars-Peter Clausen
2013-05-20 18:24   ` Wolfram Sang
2013-05-20 18:26     ` Lars-Peter Clausen
2013-05-20 18:51       ` Julia Lawall
2013-05-20 19:13         ` Lars-Peter Clausen
2013-05-22 17:36           ` Julia Lawall
2013-05-26 20:01           ` Julia Lawall

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.