This section presents some tips and tricks for using Coccinelle.
If you want to rewrite any access to a pointer value by a function call, you may use the following semantic patch.
However, if for some reason your code looks like
bar = *(foo),
you will end up with
bar = readb((foo)) as the extra
parentheses around foo are capture by the metavariable
In order to generate better output code, you can use the following semantic patch instead.
And rely on your standard.iso isomorphism file which should contain:
Coccinelle will then consider
bar = *(foo) as equivalent to
bar = *foo (but not the other way around) and capture both.
Finally, it will generate
bar = readb(foo) as expected.