On Wed, 27 Dec 2017, SF Markus Elfring wrote:
> >>> The cast is useful when it is to a non-pointer type.
> >>
> >> Will it be needed then to use an other metavariable for the assignment
> >> target?
> >>
> >> How much would you like to distinguish if an item should handle a pointer
> >> (or not)?
> >
> > The compiler will complain about an assignment between an integer and a
> > pointer,
>
> This tool distinguishes data types better.
>
>
> > so one can assume that if the code is
> >
> > x = (T *)kmalloc();
> >
> > then x has pointer type.
>
> We “hope” so.
>
> How do you think about restrict the type for an acceptable target expression?
It's pointless:
1. Code should not be committed into the kernel if it causes build
problems, even warnings.
2. Adding type restrictions will only allow the code to be match if the
types are available. Having the types available will often require
including header files. This will massively slow down the execution time
of Coccinelle, in this case for no benefit.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci