All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] spatch errors out with "not supported"
@ 2022-06-30  8:08 Ilpo Järvinen
  2022-07-07 17:09 ` [cocci] Support for construct “do {…} while(…)”? Markus Elfring
  2022-07-16 13:02 ` [cocci] spatch errors out with "not supported" Julia Lawall
  0 siblings, 2 replies; 3+ messages in thread
From: Ilpo Järvinen @ 2022-06-30  8:08 UTC (permalink / raw)
  To: cocci

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.


-- 
 i.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [cocci] Support for construct “do {…} while(…)”?
  2022-06-30  8:08 [cocci] spatch errors out with "not supported" Ilpo Järvinen
@ 2022-07-07 17:09 ` Markus Elfring
  2022-07-16 13:02 ` [cocci] spatch errors out with "not supported" Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2022-07-07 17:09 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: cocci

> 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.


I suggest to take another look also at a previous clarification request.
https://github.com/coccinelle/coccinelle/issues/187

Regards,
Markus


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [cocci] spatch errors out with "not supported"
  2022-06-30  8:08 [cocci] spatch errors out with "not supported" Ilpo Järvinen
  2022-07-07 17:09 ` [cocci] Support for construct “do {…} while(…)”? Markus Elfring
@ 2022-07-16 13:02 ` Julia Lawall
  1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2022-07-16 13:02 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: cocci

[-- Attachment #1: Type: text/plain, Size: 2213 bytes --]



On Thu, 30 Jun 2022, Ilpo Järvinen wrote:

> 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 (...);

do while should be supported now.

julia

>
> 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.
>
>
> --
>  i.
>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-16 13:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-30  8:08 [cocci] spatch errors out with "not supported" Ilpo Järvinen
2022-07-07 17:09 ` [cocci] Support for construct “do {…} while(…)”? Markus Elfring
2022-07-16 13:02 ` [cocci] spatch errors out with "not supported" Julia Lawall

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.