Re: [Cocci] Checking the parsing for a specific SmPL disjunction

2020-06-25 Thread Julia Lawall



On Thu, 25 Jun 2020, Markus Elfring wrote:

> >> @display@
> >> expression x, y;
> >> @@
> >> *y = ... *(x) ...
> >
> > This is probably not what you think.  It is an assignment of y to a
> > multiplication followed by some other code (the second ...).
>
> I would interpret such a source code search approach in the way
> that a varying expression which contains one known (?) operation
> is assigned to an other target.
>
> Can the ambiguity for the asterisk (before the parentheses) be avoided?
>
>
> Should the following script variant for the semantic patch language
> match only code with pointer dereferences?
>
> @display@
> expression* x;
> expression y;
> @@
> *y = ... *(x) ...

There is no ... like this at the expression level.  You can say <+...
*(x) ...+> if you want *(x) to be a subexpression of the right hand side.

julia


>
>
>
> >> @display@
> >> expression action, x, y;
> >> @@
> >> (
> >> *y = ... *(x) ...
> >> |
> >> *action(..., x, ...)
> >> )
>
> May I expect that such SmPL disjunctions should also work?
>
> Regards,
> Markus
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


Re: [Cocci] Checking the parsing for a specific SmPL disjunction

2020-06-25 Thread Julia Lawall


On Thu, 25 Jun 2020, Markus Elfring wrote:

> Hello,
>
> I know that the following SmPL script example gets accepted
> by the Coccinelle software.
>
> @display@
> expression x, y;
> @@
> *y = ... *(x) ...

This is probably not what you think.  It is an assignment of y to a
multiplication followed by some other code (the second ...).

julia

>
>
> I have tried another tiny script variant out for the semantic patch language
> (according to the software combination “Coccinelle 1.0.8-00131-g675b9670”).
>
> @display@
> expression action, x, y;
> @@
> (
> *y = ... *(x) ...
> |
> *action(..., x, ...)
> )
>
>
> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci 
> show_pointer_dereferences3.cocci
> init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
> minus: parse error:
>   File "show_pointer_dereferences3.cocci", line 5, column 14, charpos = 54
>   around = '...',
>   whole content = *y = ... *(x) ...
>
>
> Should such SmPL disjunctions work in the future?
>
> Regards,
> Markus
> ___
> Cocci mailing list
> Cocci@systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
>___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] Checking the parsing for a specific SmPL disjunction

2020-06-25 Thread Markus Elfring
Hello,

I know that the following SmPL script example gets accepted
by the Coccinelle software.

@display@
expression x, y;
@@
*y = ... *(x) ...


I have tried another tiny script variant out for the semantic patch language
(according to the software combination “Coccinelle 1.0.8-00131-g675b9670”).

@display@
expression action, x, y;
@@
(
*y = ... *(x) ...
|
*action(..., x, ...)
)


elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --parse-cocci 
show_pointer_dereferences3.cocci
init_defs_builtins: /usr/local/bin/../lib/coccinelle/standard.h
minus: parse error:
  File "show_pointer_dereferences3.cocci", line 5, column 14, charpos = 54
  around = '...',
  whole content = *y = ... *(x) ...


Should such SmPL disjunctions work in the future?

Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci