Coccinelle Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: rusty@rustcorp.com.au (Rusty Russell)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Simple replacement of an expression of given type?
Date: Sat, 21 Jun 2014 09:08:41 +0930	[thread overview]
Message-ID: <87y4wrtam6.fsf@rustcorp.com.au> (raw)

Hi!

        In my current project, I moved a field from a structure
(struct block) into another network-endian structure.  I used the
following patch.cocci to do the fixups:

        @ rule1 @
        struct block *b;
        @@
        
        - b->blocknum
        + le32_to_cpu(b->hdr->depth)

It got 99%, but it missed the two cases where b was actually in another
structure, ie. "te->block->blocknum".

I *think* this is because I want to substitute any expression of type
struct block *, rather than only identifiers?

But I couldn't understand the documentation enough to do this :(

Clues appreciated!
Rusty.

             reply	other threads:[~2014-06-20 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-20 23:38 Rusty Russell [this message]
2014-06-21  6:27 ` [Cocci] Simple replacement of an expression of given type? Lars-Peter Clausen
2014-06-21  6:28 ` Julia Lawall
2014-06-21  7:06   ` Rusty Russell

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=87y4wrtam6.fsf@rustcorp.com.au \
    --to=rusty@rustcorp.com.au \
    --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