All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] Make rule depend on comment
@ 2019-08-02  7:34 Christoph Böhmwalder
  2019-08-03 12:32 ` Markus Elfring
  2019-08-03 12:44 ` Julia Lawall
  0 siblings, 2 replies; 10+ messages in thread
From: Christoph Böhmwalder @ 2019-08-02  7:34 UTC (permalink / raw)
  To: cocci

Hi,

I have a question regarding the new "comments" feature. Suppose the following:

test.cocci
----------
@ r @
identifier fn;
comments c;
@@
fn()@c
{
}

@ script:python @
fn << r.fn;
c << r.c;
@@
print(fn + " has comment: " + c[0].after)


test.c
------
int f() /* a comment */ { }
int g() { }


spatch --sp-file test.cocci test.c
----------------------------------
f has comment: /* a comment */
g has comment:


The issue here is that I would like to trigger the python script
(i.e. satisfy the "r" rule) iff the comment is actually present.
Can I make the rule depend on the comment being there?

Thanks,

--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA —  Disaster Recovery — Software defined Storage
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

end of thread, other threads:[~2019-08-09 15:08 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02  7:34 [Cocci] Make rule depend on comment Christoph Böhmwalder
2019-08-03 12:32 ` Markus Elfring
2019-08-03 12:44 ` Julia Lawall
2019-08-05  8:36   ` Christoph Böhmwalder
2019-08-05 10:21     ` Julia Lawall
2019-08-06  7:03     ` Markus Elfring
2019-08-07 21:40     ` Julia Lawall
2019-08-08  8:35       ` Markus Elfring
2019-08-08  9:32       ` Christoph Böhmwalder
2019-08-09 15:07       ` Markus Elfring

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.