Skip to contentSkip to conversation

coccinelle: iterators: Add for_each_child.cocci script

PATCH Markus Elfring 2 participants 2 messages Sep 24, 2020 Kernel janitors

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

+@ruletwo depends on patch && !context && !org && !report@

How do you think about to combine code from two SmPL rules by using another SmPL disjunction like the following?

@addition_rule depends on patch && !context && !org && !report@ local idexpression r.n;
expression e,e1;
expression list [r.n1] es;
iterator r.i,i1,i2;
statement S,S2;
@@
(
i(es,n,...) {
...
(of_node_put(n);

|e = n
|return n;
|i1(...,n,...) S
|

+of_node_put(n);
?return ...;
)
... when any
}
|
i(es,n,...) {
...
(of_node_put(n);

|e = n
|i1(...,n,...) S
|

+of_node_put(n);
?break;
)
... when any
}
... when != n
when strict
(n = e1;
|
?i2(...,n,...) S2
)
)

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

#1 lore raw
Quoted 4 lines · Markus Elfring
Quoted 1 line

+@ruletwo depends on patch && !context && !org && !report@

How do you think about to combine code from two SmPL rules by using another SmPL disjunction like the following?

What is the goal of doing this?

It seems substantially harder to understand than three rules that each take care of a specific case.

julia

Quoted 49 lines

@addition_rule depends on patch && !context && !org && !report@ local idexpression r.n;
expression e,e1;
expression list [r.n1] es;
iterator r.i,i1,i2;
statement S,S2;
@@
(
i(es,n,...) {
...
(of_node_put(n);

|e = n
|return n;
|i1(...,n,...) S
|

+of_node_put(n);
?return ...;
)
... when any
}
|
i(es,n,...) {
...
(of_node_put(n);

|e = n
|i1(...,n,...) S
|

+of_node_put(n);
?break;
)
... when any
}
... when != n
when strict
(n = e1;
|
?i2(...,n,...) S2
)
)

Regards,
Markus
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci