Re: [cocci] Matching objects as well as pointers to objects?

Markus Elfring <[email protected]>
Newsgroups fr.inria.cocci
Message-ID <[email protected]>
> Both cases are equivalent at the C code level.

I suggest to reconsider this view.
Different access operators are involved.


> Can Coccinelle recognize this kind of equivalence

Which kind of pattern recognition would you find more convenient here?


> and is there a way to match both cases with a single patch?

The SmPL code can be refined.


@replacement@
expression bio, errno;
@@
(
-bio.bi_status = errno_to_blk_status(errno);
-bio_endio
+bio_endio_errno
          (&bio
+          , errno
          );
|
-bio->bi_status = errno_to_blk_status(errno);
-bio_endio
+bio_endio_errno
          (bio
+          , errno
          );
)


Regards,
Markus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.