[cocci] Matching objects as well as pointers to objects?
Andreas Gruenbacher <[email protected]>
| Newsgroups | fr.inria.cocci |
|---|---|
| Message-ID | <CAHc6FU46Pusn-rq2TeCV+nBOiW5YUEGOuVRLQHOatniVJaT8pg@mail.gmail.com> |
Hello, I have a question about using Coccinelle for C code (for the Linux kernel). I'm trying to get Coccinelle to make the following change for me: @@ expression bio, errno; @@ - bio->bi_status = errno_to_blk_status(errno); - bio_endio(bio); + bio_endio_errno(bio, errno); This matches when bio is a pointer, but when bio is a struct, the following patch seems to be needed: @@ expression bio, errno; @@ - bio.bi_status = errno_to_blk_status(errno); - bio_endio(&bio); + bio_endio_errno(&bio, errno); Both cases are equivalent at the C code level. Can Coccinelle recognize this kind of equivalence and is there a way to match both cases with a single patch? Thanks a lot, Andreas