[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f4376c72-b255-4cc-959a-8c947addb4ca@inria.fr>
Date: Fri, 7 Nov 2025 09:05:24 +0100 (CET)
From: Julia Lawall <julia.lawall@...ia.fr>
To: Songwei Chai <quic_songchai@...cinc.com>
cc: Nicolas Palix <nicolas.palix@...g.fr>, cocci@...ia.fr,
linux-kernel@...r.kernel.org, quic_tingweiz@...cinc.com,
quic_jinlmao@...cinc.com
Subject: Re: [cocci] [PATCH v2] scripts: coccicheck: filter *.cocci files by
MODE
On Fri, 6 Jun 2025, Songwei Chai wrote:
> 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.
Pushed to my tree (for-6.19 branch)
>
> Signed-off-by: Songwei Chai <quic_songchai@...cinc.com>
> ---
> scripts/coccicheck | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/coccicheck b/scripts/coccicheck
> index 0e6bc5a10320..89d591af5f3e 100755
> --- a/scripts/coccicheck
> +++ b/scripts/coccicheck
> @@ -270,7 +270,11 @@ fi
>
> if [ "$COCCI" = "" ] ; then
> for f in `find $srctree/scripts/coccinelle/ -name '*.cocci' -type f | sort`; do
> - coccinelle $f
> + if grep -q "virtual[[:space:]]\+$MODE" "$f"; then
> + coccinelle $f
> + else
> + echo "warning: Skipping $f as it does not match mode '$MODE'"
> + fi
> done
> else
> coccinelle $COCCI
>
>
Powered by blists - more mailing lists