cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* Re: [Cocci] transform oddity
@ 2020-08-30  8:25 Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-08-30  8:25 UTC (permalink / raw)
  To: Joe Perches; +Cc: cocci

> Is it me not understanding cocci grammar again?

You are also struggling with expressing your data processing needs
by the means of the semantic patch language.

You would like to rename three parameters for selected functions.
I imagine that an other transformation specification will be more appropriate
for the function body.


> {
> 	...
> (
> -	arg1
> +	dev
> |
> -	arg2
> +	attr
> |
> -	arg3
> +	buf
> )
> 	... when any
> }

I suggest to use a SmPL nest construct.
https://github.com/coccinelle/coccinelle/blob/730dbb034559b3e549ec0b2973cd0400a3fa072f/docs/manual/cocci_syntax.tex#L789

 {
 <+...
(
-arg1
+dev
|
-arg2
+attr
|
-arg3
+buf
)
 ...+>
 }



> identifier d_show =~ "^.*show.*$";

By the way:
Would you like to omit the specification “.*$” from the regular expression
for this SmPL constraint?

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] transform oddity
       [not found]   ` <caa68538-22db-9ae4-79d8-8181a8f6e873@web.de>
@ 2020-08-30 10:50     ` Julia Lawall
  0 siblings, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2020-08-30 10:50 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Joe Perches, cocci



On Sun, 30 Aug 2020, Markus Elfring wrote:

> >> How do you think about to use the following transformation variant?
> >
> > This is uselessly expensive.  It is already known that there is at least
> > one occurrence of x.
>
> Would we like to care if the affected identifier should be updated more than once
> in a selected function implementation?

Theer is no way to specify "more than once".  We know it will be updated
at least once because we know that there is at least one occurrence.

julia
_______________________________________________
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] transform oddity
       [not found] <46122ad6-9c65-93d0-5dfc-b47f4340df7f@web.de>
@ 2020-08-30  9:44 ` Julia Lawall
       [not found]   ` <caa68538-22db-9ae4-79d8-8181a8f6e873@web.de>
  0 siblings, 1 reply; 3+ messages in thread
From: Julia Lawall @ 2020-08-30  9:44 UTC (permalink / raw)
  To: Markus Elfring; +Cc: Joe Perches, cocci



On Sun, 30 Aug 2020, Markus Elfring wrote:

> > - T x@p;
> > + int len
> >   <...
> > - x
> > + len
> >   ...>
>
> How do you think about to use the following transformation variant?

This is uselessly expensive.  It is already known that there is at least
one occurrence of x.

julia

>
> -T x@p;
> +int len;
>  <+...
> -x
> +len
>  ...+>
>
>
> 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-08-30 10:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-30  8:25 [Cocci] transform oddity Markus Elfring
     [not found] <46122ad6-9c65-93d0-5dfc-b47f4340df7f@web.de>
2020-08-30  9:44 ` Julia Lawall
     [not found]   ` <caa68538-22db-9ae4-79d8-8181a8f6e873@web.de>
2020-08-30 10:50     ` 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).