cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] Checking the parsing for a specific SmPL disjunction
@ 2020-06-25 15:00 Markus Elfring
  2020-06-25 15:11 ` Julia Lawall
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2020-06-25 15:00 UTC (permalink / raw)
  To: Coccinelle

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

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

* Re: [Cocci] Checking the parsing for a specific SmPL disjunction
  2020-06-25 15:00 [Cocci] Checking the parsing for a specific SmPL disjunction Markus Elfring
@ 2020-06-25 15:11 ` Julia Lawall
       [not found]   ` <79cbff87-a004-aa34-1b1c-6229c645389d@web.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-06-25 15:11 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Coccinelle

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



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
>

[-- Attachment #2: Type: text/plain, Size: 136 bytes --]

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

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

* Re: [Cocci] Checking the parsing for a specific SmPL disjunction
       [not found]   ` <79cbff87-a004-aa34-1b1c-6229c645389d@web.de>
@ 2020-06-25 18:00     ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2020-06-25 18:00 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Coccinelle



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

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

end of thread, other threads:[~2020-06-25 18:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 15:00 [Cocci] Checking the parsing for a specific SmPL disjunction Markus Elfring
2020-06-25 15:11 ` Julia Lawall
     [not found]   ` <79cbff87-a004-aa34-1b1c-6229c645389d@web.de>
2020-06-25 18:00     ` Julia Lawall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).