From: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
To: cocci@systeme.lip6.fr
Subject: [Cocci] Make rule depend on comment
Date: Fri, 2 Aug 2019 09:34:19 +0200 [thread overview]
Message-ID: <b4c91fb8-5606-c06e-e349-5415458cf3b5@linbit.com> (raw)
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
next reply other threads:[~2019-08-02 7:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-02 7:34 Christoph Böhmwalder [this message]
2019-08-03 12:32 ` [Cocci] Make rule depend on comment 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
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=b4c91fb8-5606-c06e-e349-5415458cf3b5@linbit.com \
--to=christoph.boehmwalder@linbit.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 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).