cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: "Julia Lawall" <julia.lawall@lip6.fr>,
	"Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Make rule depend on comment
Date: Fri, 9 Aug 2019 17:07:56 +0200	[thread overview]
Message-ID: <30294acc-faa0-4d29-55c1-f1710ca88037@web.de> (raw)
In-Reply-To: <alpine.DEB.2.21.1908072337230.2601@hadrien>

> If you pull Coccinelle from github, you will be able to write the following.

I am curious how the support will evolve further for scripted SmPL constraints.


> The second scriptcan use ocaml or python as you like.

How do you think about to clarify the following SmPL rule variant?

@addition@
km;
comments tag : script:ocaml ()
 {
 let (_, _, ca) = List.hd tag in
 match ca with
 [] -> false
 | _ -> let xa = String.concat "" ca in
        if Str.string_match (Str.regexp "kmap compat: \(KM_USER[01]\)") xa 2
        then km := make_ident (Str.matched_group 1 xa); true
        else false
 };
expression context;
identifier fn;
@@
 fn(...)@tag
 {
 <+...
(kmap_atomic
|kunmap_atomic
)(context
+, km
 )
 ...+>
 }


int foo()
/* kmap compat: KM_USER0 */
{
void *addr = kmap_atomic(page);
// ...
kunmap_atomic(addr);
}


Can such a data processing approach ever work in the shown direction?

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

      parent reply	other threads:[~2019-08-09 15:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=30294acc-faa0-4d29-55c1-f1710ca88037@web.de \
    --to=markus.elfring@web.de \
    --cc=christoph.boehmwalder@linbit.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@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).