Evolutionary development of a semantic patch using Coccinelle
Evolutionary development of a semantic patch using Coccinelle
Posted Mar 31, 2010 12:34 UTC (Wed) by lawall (guest, #56234)In reply to: Evolutionary development of a semantic patch using Coccinelle by wsa
Parent article: Evolutionary development of a semantic patch using Coccinelle
@r@
struct device_driver var;
expression E;
@@
* var.groups = E;
Expands into essentially the following, via a user-configurable notion of "isomorphisms", which describe code patterns that are considered to be the same:
@@
struct device_driver var;
struct device_driver *_E1_1;
identifier _I_0;
@@
(
*var.groups = E;
|
*_E1_1->groups = E;
|
*struct device_driver _I_0 = {.groups = E,
};
)
This, however, doesn't match cases where the assignment is a subexpression of another expression. For that you could have to do:
@r@
struct device_driver var;
expression E;
@@
* var.groups = E
which would match both the . and the -> case, again via an isomorphism.
julia
