cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Quentin Young <qlyoung@qlyoung.net>
To: cocci@systeme.lip6.fr
Subject: [Cocci] How to write SmPL patch to handle for-each macros?
Date: Wed, 3 Jul 2019 11:46:21 -0400	[thread overview]
Message-ID: <D38654B4-F23E-4715-ABB2-9DB58CB5610F@qlyoung.net> (raw)

Hi there, I was wondering how to handle this situation in SmPL. I have a
codebase that defines a couple macros for use within for loops, mostly used to
iterate lists, like this:

for (LIST_ELEMENTS(…)) {
   /* blah blah */
}

I’m having trouble figuring out how to write a rule that matches these for
statements without resorting to doing preprocessor expansion before I run
spatch. The semantics I’m trying to achieve are:

@@
…
@@

for (LIST_ELEMENTS(…)) {
   /* stuff I want to match is here */
}

Could I get some help? Barring that, I’d also take a link to the appropriate
documentation, if I’ve missed it. Thanks in advance.

Quentin
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

             reply	other threads:[~2019-07-09  6:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03 15:46 Quentin Young [this message]
2019-07-09  6:07 ` [Cocci] How to write SmPL patch to handle for-each macros? Julia Lawall

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=D38654B4-F23E-4715-ABB2-9DB58CB5610F@qlyoung.net \
    --to=qlyoung@qlyoung.net \
    --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).