[Linux-kernel-mentees] [PATCH 10/23] parsing_cocci: iso_pattern: Reflect Parameter attributes

Julia Lawall julia.lawall at inria.fr
Mon Apr 27 17:06:48 UTC 2020



On Mon, 27 Apr 2020, Jaskaran Singh wrote:

> Parameter attributes are added to the SmPL AST. Reflect these changes in
> iso_pattern.ml.
>
> Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
> ---
>  parsing_cocci/iso_pattern.ml | 22 ++++++++++++++++++----
>  1 file changed, 18 insertions(+), 4 deletions(-)
>
> diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml
> index 9df21fb9..09a39bdf 100644
> --- a/parsing_cocci/iso_pattern.ml
> +++ b/parsing_cocci/iso_pattern.ml
> @@ -1165,10 +1165,24 @@ let match_maker checks_needed context_required whencode_allowed =
>  	if not(checks_needed) || not(context_required) || is_context p
>  	then
>  	  match (up,Ast0.unwrap p) with
> -	    (Ast0.VoidParam(tya),Ast0.VoidParam(tyb)) -> match_typeC tya tyb
> -	  | (Ast0.Param(tya,ida),Ast0.Param(tyb,idb)) ->
> -	      conjunct_bindings (match_typeC tya tyb)
> -		(match_option match_ident ida idb)
> +	    (Ast0.VoidParam(tya,attra),Ast0.VoidParam(tyb,attrb)) ->
> +               if
> +                (List.length attra = List.length attrb &&
> +                 List.fold_left2 (fun p a b -> p && mcode_equal a b) true
> +                 attra attrb)

Could you move the ( line up to the right of the if?

thanks,
julia

> +               then
> +                 match_typeC tya tyb
> +               else return false
> +	  | (Ast0.Param(tya,ida,attra),Ast0.Param(tyb,idb,attrb)) ->
> +               if
> +                (List.length attra = List.length attrb &&
> +                 List.fold_left2 (fun p a b -> p && mcode_equal a b) true
> +                 attra attrb)
> +              then
> +	        conjunct_bindings (match_typeC tya tyb)
> +		  (match_option match_ident ida idb)
> +              else
> +                return false
>  	  | (Ast0.PComma(c1),Ast0.PComma(c)) -> check_mcode c1 c
>  	  | (Ast0.Pdots(d1),Ast0.Pdots(d)) -> check_mcode d1 d
>  	  | (Ast0.OptParam(parama),Ast0.OptParam(paramb)) ->
> --
> 2.21.1
>
>


More information about the Linux-kernel-mentees mailing list