cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: "Christoph Böhmwalder" <christoph.boehmwalder@linbit.com>
Cc: cocci@systeme.lip6.fr
Subject: Re: [Cocci] Make rule depend on comment
Date: Tue, 6 Aug 2019 09:03:27 +0200	[thread overview]
Message-ID: <6a333f77-5132-940a-4b1a-d6c474345ea6@web.de> (raw)
In-Reply-To: <656aeb1b-9c94-a428-bb0e-4397a0432651@linbit.com>

>     if match:
>         coccinelle.km = match.group(1)

I suggest to add a bit of code like the following.

    else:
         cocci.include_match(False)


How do you think about to use an other SmPL rule variant?

@addition@
expression context;
identifier find_kmap_tagged_function.fn, parse_kmap_tag.km;
@@
 fn(...)
 {
 <+...
(kmap_atomic
|kunmap_atomic
)(context
+, km
 )
 ...+>
 }


Would the use of an additional position variable influence the run time characteristics
in positive ways for this data processing approach?


> This works just fine, except for the case where no "tag" was found.

Would you like to extend corresponding case distinctions any further?


> Ideally, I would like for coccinelle to not touch the function at all if it doesn't
> have a "tag". I'm not sure if this is objectively the best solution, but it seems
> the most logical to me.

Did you check any development possibilities around constraints for metavariables?

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

  parent reply	other threads:[~2019-08-06  7:04 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 [this message]
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=6a333f77-5132-940a-4b1a-d6c474345ea6@web.de \
    --to=markus.elfring@web.de \
    --cc=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).