[Cocci] Change function invocations argument

Julia Lawall julia.lawall at lip6.fr
Sun Dec 21 13:04:16 CET 2014



On Sun, 21 Dec 2014, SF Markus Elfring wrote:

> > @@ typedef long_u, uintmax_t; expression e1, e2, e3; @@
> > 
> >     put_bytes(
> >         e1,
> > (
> > -       (long_u)(e2)
> > |
> > -       (long_u)e2
> > )
> > +       (uintmax_t)e2
> >         ,
> > (
> > -       (int)(e3)
> > +       (unsigned int)e3
> > |
> > -       (int)e3
> > +       (unsigned int)e3
> > |
> >         e3
> > )
> >     )
> 
> Can it be that you need to fiddle with SmPL disjunctions a bit less here
> because the metavariable type (or an isomorphism) will take care for
> additional parentheses around the affected expressions?
> 
> How do you think about the applicability of the following approach?
> 
> @parameter_cast_replacement@
> expression e1, e2, e3;
> typedef long_u, uintmax_t;
> @@
>  put_bytes(e1,
> -          (long_u)
> +          (uintmax_t)
>            e2,
> (
> -          (int)
> +          (unsigned int)
>            e3
> |
>            e3
> )
>           )

It looks like Eliseo wants to get rid of the parentheses, which your 
approach does not do.  On the other hand, Markus is right that 

> > (
> > -       (long_u)(e2)
> > |
> > -       (long_u)e2
> > )

could be just

-       (long_u)(e2)

and an isomorphism will allow it to match the case where the parentheses 
are already removed as well.

julia


> 
> Regards,
> Markus
> _______________________________________________
> Cocci mailing list
> Cocci at systeme.lip6.fr
> https://systeme.lip6.fr/mailman/listinfo/cocci
> 


More information about the Cocci mailing list