Restricting SmPL disjunctions for identifier selections?
From: Markus Elfring
Date: Tue Aug 11 2026 - 04:16:11 EST
Hello,
Another tiny script variant for the semantic patch language can eventually help
to clarify special development ideas.
@my_test@
expression x;
@@
*x =
(kmalloc
|kstrdup
)(...)
Questionable test result (according to the software combination “Coccinelle 1.3.1”):
Markus_Elfring@Sonne:…/Projekte/Coccinelle/Probe> /usr/bin/spatch --parse-cocci test-disjunction.cocci
init_defs_builtins: /usr/lib64/coccinelle/standard.h
@my_test@
expression x;
@@
(
*x *= kmalloc(...)
|
*x *= kstrdup(...)
)
Grep query
kstrdup || kmalloc
Would you get into the mood to discuss further data processing possibilities?
A)
The originally specified SmPL disjunction is expanded by the Coccinelle software
so far.
It was indicated to perform a source code search for selected identifiers.
Would it be nicer to benefit any more from such a data restriction?
B)
The identifier selection was reversed for the construction of a grep command.
Can filter ordering matter any more for efficient text searches?
https://en.wikipedia.org/wiki/Short-circuit_evaluation
Regards,
Markus