Coccinelle archive on lore.kernel.org
 help / color / 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, back to index

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

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git