[Cocci] Compacting parameters into fewer lines
julia.lawall at lip6.fr
Wed Aug 1 08:17:46 CEST 2018
> How do you think about to improve the replacement specification a bit more
> by combining the variants A till D into a single SmPL rule which will use
> a nested SmPL disjunction?
I haven't actually looked at the semantic patch code, but I would point out
that making a disjunction is not always a good idea. The semantics of a
disjunction is that if an earlier pattern matches, then the later patterns
are not considered. The semantics of a succession of rules is that later
patterns are applied to the result of earlier patterns. These are clearly
not the same things. At the expression level, ensuring that subsequent
patterns don't apply if earlier ones do entails quite a lot of work, so a
disjunction may not be very efficient. This performance issue is much less
at the statement level.
If there are no semantics or performance issues involved, then I would be
inclined to think that the way the person first decided to write the rule is
the best way, because that is how they thought about the problem.
More information about the Cocci