Skip to content

Commit 3766511

Browse files
Songwei ChaiJuliaLawall
authored andcommitted
scripts: coccicheck: filter *.cocci files by MODE
Enhance the coccicheck script to filter *.cocci files based on the specified MODE (e.g., report, patch). This ensures that only compatible semantic patch files are executed, preventing errors such as: "virtual rule report not supported" This error occurs when a .cocci file does not define a 'virtual <MODE>' rule, yet is executed in that mode. For example: make coccicheck M=drivers/hwtracing/coresight/ MODE=report In this case, running "secs_to_jiffies.cocci" would trigger the error because it lacks support for 'report' mode. With this change, such files are skipped automatically, improving robustness and developer experience. Signed-off-by: Songwei Chai <quic_songchai@quicinc.com> Reviewed-by: Julia Lawall <Julia.Lawall@inria.fr>
1 parent 9094662 commit 3766511

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

scripts/coccicheck

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,11 @@ fi
270270

271271
if [ "$COCCI" = "" ] ; then
272272
for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
273-
coccinelle $f
273+
if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
274+
coccinelle $f
275+
else
276+
echo "warning: Skipping $f as it does not match mode '$MODE'"
277+
fi
274278
done
275279
else
276280
coccinelle $COCCI

0 commit comments

Comments
 (0)