[Linux-kernel-mentees] [PATCH 09/32] parsing_cocci: arity: Reflect Cast attributes

Julia Lawall julia.lawall at inria.fr
Sun May 3 19:28:21 UTC 2020



On Tue, 28 Apr 2020, Jaskaran Singh wrote:

> Cast attributes are added to the SmPL AST. Reflect these changes in
> arity.ml.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
>  parsing_cocci/arity.ml | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/parsing_cocci/arity.ml b/parsing_cocci/arity.ml
> index 8ee6d33f..880cd7a3 100644
> --- a/parsing_cocci/arity.ml
> +++ b/parsing_cocci/arity.ml
> @@ -254,13 +254,14 @@ let rec top_expression opt_allowed tgt expr =
>        let ar = mcode ar in
>        let field = ident false arity field in
>        make_exp expr tgt arity (Ast0.RecordPtAccess(exp,ar,field))
> -  | Ast0.Cast(lp,ty,rp,exp) ->
> +  | Ast0.Cast(lp,ty,attr,rp,exp) ->
>        let arity = exp_same (mcode2line lp) [mcode2arity lp;mcode2arity rp] in
>        let lp = mcode lp in
>        let ty = typeC arity ty in
> +      let attr = List.map mcode attr in

Since attrs are mcodes, they should be reflected in the list that is given
to exp_same.

julia


>        let rp = mcode rp in
>        let exp = expression arity exp in
> -      make_exp expr tgt arity (Ast0.Cast(lp,ty,rp,exp))
> +      make_exp expr tgt arity (Ast0.Cast(lp,ty,attr,rp,exp))
>    | Ast0.SizeOfExpr(szf,exp) ->
>        let arity = exp_same (mcode2line szf) [mcode2arity szf] in
>        let szf = mcode szf in
> --
> 2.21.1
>
>


More information about the Linux-kernel-mentees mailing list