spatch errors out with "not supported"
Hi all,
I tried to find a particular pattern with coccinelle, but it seems to give me an error. Here's a trimmed down version highlighting the problem:
$ make C=2 MODE=patch CHECK=scripts/coccicheck COCCI=scripts/coccinelle/cleanups/write_verify2.cocci drivers/ata/sata_mv.o CHECK scripts/mod/empty.c /usr/bin/spatch -D patch --very-quiet --cocci-file scripts/coccinelle/cleanups/write_verify2.cocci -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h scripts/mod/empty.c not supported coccicheck failed make[1]: *** [scripts/Makefile.build:250: scripts/mod/empty.o] Error 255 make: *** [Makefile:1199: prepare0] Error 2 $
Here's write_verify2.cocci:
virtual patch
@@
identifier writefunc =~ ".*write.*";
identifier readfunc =~ ".*read.*";
identifier rval;
expression wval, reg;
@@
- do {
- writefunc(wval, reg); - rval = readfunc(reg); - udelay(...);
- } while (...);
If I comment out those do and while lines, coccinelle picks up the relevant fragments (but the loop is important part of the full construct I'm looking for). Why does it fail with do {} while ()? I've checked the grammar and according to it "do single_stmt while (dot_expr);" should be a valid construct.
$ spatch --version spatch version 1.1.0 compiled with OCaml version 4.11.1 Flags passed to the configure script: --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --enable-ocaml --enable-python --enable-opt OCaml scripting support: yes Python scripting support: yes Syntax of regular expressions: PCRE $
I feel I've seen that "not supported" other times too. I don't know if it's easy to make it more verbose where things go wrong (I could find any option which would have told me more than that). Such an error message isn't that helpful like you can imagine.
Signature · 1 line
i.
Re: [cocci] Support for construct “do {…} while(…)”?
Quoted 5 lines
If I comment out those do and while lines, coccinelle picks up the relevant fragments (but the loop is important part of the full construct I'm looking for). Why does it fail with do {} while ()? I've checked the grammar and according to it "do
single_stmtwhile (dot_expr);" should be a valid construct.
I suggest to take another look also at a previous clarification request.
https://github.com/coccinelle/coccinelle/issues/187
Regards,
Markus
Quoted 29 lines · Ilpo Järvinen
Hi all,
I tried to find a particular pattern with coccinelle, but it seems to give me an error. Here's a trimmed down version highlighting the problem:
$ make C=2 MODE=patch CHECK=scripts/coccicheck COCCI=scripts/coccinelle/cleanups/write_verify2.cocci drivers/ata/sata_mv.o CHECK scripts/mod/empty.c /usr/bin/spatch -D patch --very-quiet --cocci-file scripts/coccinelle/cleanups/write_verify2.cocci -I ./arch/x86/include -I ./arch/x86/include/generated -I ./include -I ./arch/x86/include/uapi -I ./arch/x86/include/generated/uapi -I ./include/uapi -I ./include/generated/uapi --include ./include/linux/compiler-version.h --include ./include/linux/kconfig.h scripts/mod/empty.c not supported coccicheck failed make[1]: *** [scripts/Makefile.build:250: scripts/mod/empty.o] Error 255 make: *** [Makefile:1199: prepare0] Error 2 $Here's
write_verify2.cocci:virtual patch
@@
identifier writefunc =~ ".*write.*";
identifier readfunc =~ ".*read.*";
identifier rval;
expression wval, reg;
@@
Review
Quoted 5 lines
(quoted diff) +0
-5- do { - writefunc(wval, reg); - rval = readfunc(reg); - udelay(...); - } while (...);
do while should be supported now.
julia
Quoted 26 lines
If I comment out those do and while lines, coccinelle picks up the relevant fragments (but the loop is important part of the full construct I'm looking for). Why does it fail with do {} while ()? I've checked the grammar and according to it "do
single_stmtwhile (dot_expr);" should be a valid construct.$ spatch --version spatch version 1.1.0 compiled with OCaml version 4.11.1 Flags passed to the configure script: --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib --enable-ocaml --enable-python --enable-opt OCaml scripting support: yes Python scripting support: yes Syntax of regular expressions: PCRE $I feel I've seen that "not supported" other times too. I don't know if it's easy to make it more verbose where things go wrong (I could find any option which would have told me more than that). Such an error message isn't that helpful like you can imagine.
--
i.