Hello,

I have tried another tiny SmPL script out.

@display@
statement s1, s2;
type T;
@@
 T nouveau_bo_alloc(...)
 {
 ... when any
 {
    ... when any
*   s1
*   s2
 }
 ... when any
 }


Such a search pattern can point source code places out which can trigger
further development considerations.
https://elixir.bootlin.com/linux/v5.4-rc2/source/drivers/gpu/drm/nouveau/nouveau_bo.c#L194
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/nouveau/nouveau_bo.c?id=3b7c59a1950c75f2c0152e5a9cd77675b09233d6#n194

System details can probably trigger also collateral evolution for
the semantic patch language (Coccinelle software).
The metavariable type “statement” supports to find C statements
according to known categories.
* Compound
* Iteration
* Selection

Can this type be restricted to C statements according to the categories
“expression” and “jump” by a way which might be simpler than the specification
of similar SmPL disjunctions?
https://en.cppreference.com/w/c/language/statements

Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to