This patch series aims to add a public function for visiting attributes to the SmPL AST visitor. This is needed to support meta attributes. Jaskaran Singh (17): parsing_cocci: visitor_ast: Add attributefn to SmPL AST visitor parsing_cocci: parse_cocci: Reflect attributefn in AST visitor parsing_cocci: cleanup_rules: Reflect attributefn in AST visitor parsing_cocci: disjdistr: Reflect attributefn in AST visitor parsing_cocci: free_vars: Reflect attributefn in AST visitor parsing_cocci: get_constants2: Reflect attributefn in AST visitor parsing_cocci: re_constraints: Reflect attributefn in AST visitor parsing_cocci: safe_for_multi_decls: Reflect attributefn in AST visitor parsing_cocci: stmtlist: Reflect attributefn in AST visitor parsing_cocci: unify_ast: Reflect attributefn in AST visitor parsing_c: unparse_hrule: Reflect attributefn in AST visitor cocci: Reflect attributefn in AST visitor engine: asttoctl2: Reflect attributefn in AST visitor engine: asttomember: Reflect attributefn in AST visitor engine: cocci_vs_c: Reflect attributefn in AST visitor engine: transformation_c: Reflect attributefn in AST visitor popl09: popltoctl: Reflect attributefn in AST visitor cocci.ml | 2 +- engine/asttoctl2.ml | 11 ++++++----- engine/asttomember.ml | 8 ++++---- engine/cocci_vs_c.ml | 4 ++-- engine/transformation_c.ml | 2 +- parsing_c/unparse_hrule.ml | 2 +- parsing_cocci/cleanup_rules.ml | 2 +- parsing_cocci/disjdistr.ml | 5 +++-- parsing_cocci/free_vars.ml | 16 +++++++++------- parsing_cocci/get_constants2.ml | 3 ++- parsing_cocci/parse_cocci.ml | 2 +- parsing_cocci/re_constraints.ml | 8 +++++--- parsing_cocci/safe_for_multi_decls.ml | 6 +++--- parsing_cocci/stmtlist.ml | 2 +- parsing_cocci/unify_ast.ml | 20 +++++++++++++------- parsing_cocci/visitor_ast.ml | 12 ++++++++---- parsing_cocci/visitor_ast.mli | 4 ++++ popl09/popltoctl.ml | 2 +- 18 files changed, 66 insertions(+), 45 deletions(-) _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
Add a public function to visit attributes in the SmPL AST visitor. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/visitor_ast.ml | 12 ++++++++---- parsing_cocci/visitor_ast.mli | 4 ++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml index 5288c6f2..17afc518 100644 --- a/parsing_cocci/visitor_ast.ml +++ b/parsing_cocci/visitor_ast.ml @@ -34,6 +34,7 @@ type 'a combiner = combiner_rule_elem : Ast.rule_elem -> 'a; combiner_statement : Ast.statement -> 'a; combiner_case_line : Ast.case_line -> 'a; + combiner_attribute : Ast.attr -> 'a; combiner_top_level : Ast.top_level -> 'a; combiner_anything : Ast.anything -> 'a; combiner_expression_dots : Ast.expression Ast.dots -> 'a; @@ -57,7 +58,7 @@ let combiner bind option_default identfn exprfn fragfn fmtfn assignOpfn binaryOpfn ftfn tyfn initfn paramfn define_paramfn declfn annotated_declfn fieldfn annotated_fieldfn enum_declfn rulefn stmtfn - casefn topfn anyfn = + casefn attributefn topfn anyfn = let multibind l = let rec loop = function [] -> option_default @@ -921,7 +922,7 @@ let combiner bind option_default let k a = match Ast.unwrap a with Ast.Attribute(attr) -> string_mcode attr in - k a + attributefn all_functions k a and whencode notfn alwaysfn = function @@ -1027,6 +1028,7 @@ let combiner bind option_default combiner_rule_elem = rule_elem; combiner_statement = statement; combiner_case_line = case_line; + combiner_attribute = attribute; combiner_top_level = top_level; combiner_anything = anything; combiner_expression_dots = expression_dots; @@ -1059,6 +1061,7 @@ type rebuilder = rebuilder_parameter_list : Ast.parameter_list inout; rebuilder_statement : Ast.statement inout; rebuilder_case_line : Ast.case_line inout; + rebuilder_attribute : Ast.attr inout; rebuilder_rule_elem : Ast.rule_elem inout; rebuilder_top_level : Ast.top_level inout; rebuilder_expression_dots : Ast.expression Ast.dots inout; @@ -1085,7 +1088,7 @@ let rebuilder enumdecldotsfn initdotsfn identfn exprfn fragfn fmtfn assignOpfn binaryOpfn ftfn tyfn initfn paramfn define_paramfn declfn annotated_declfn fieldfn annotated_fieldfn - enum_declfn rulefn stmtfn casefn topfn anyfn = + enum_declfn rulefn stmtfn casefn attributefn topfn anyfn = let get_option f = function Some x -> Some (f x) | None -> None in @@ -1917,7 +1920,7 @@ let rebuilder Ast.rewrap a (match Ast.unwrap a with Ast.Attribute(attr) -> Ast.Attribute(string_mcode attr)) in - k a + attributefn all_functions k a and whencode notfn alwaysfn = function Ast.WhenNot a -> Ast.WhenNot (notfn a) @@ -2026,6 +2029,7 @@ let rebuilder rebuilder_rule_elem = rule_elem; rebuilder_statement = statement; rebuilder_case_line = case_line; + rebuilder_attribute = attribute; rebuilder_top_level = top_level; rebuilder_expression_dots = expression_dots; rebuilder_statement_dots = statement_dots; diff --git a/parsing_cocci/visitor_ast.mli b/parsing_cocci/visitor_ast.mli index 0ed17774..55bfbf3f 100644 --- a/parsing_cocci/visitor_ast.mli +++ b/parsing_cocci/visitor_ast.mli @@ -23,6 +23,7 @@ type 'a combiner = combiner_rule_elem : Ast_cocci.rule_elem -> 'a; combiner_statement : Ast_cocci.statement -> 'a; combiner_case_line : Ast_cocci.case_line -> 'a; + combiner_attribute : Ast_cocci.attr -> 'a; combiner_top_level : Ast_cocci.top_level -> 'a; combiner_anything : Ast_cocci.anything -> 'a; combiner_expression_dots : Ast_cocci.expression Ast_cocci.dots -> 'a; @@ -77,6 +78,7 @@ val combiner : ((Ast_cocci.rule_elem,'a) ccode) -> ((Ast_cocci.statement,'a) ccode) -> ((Ast_cocci.case_line,'a) ccode) -> + ((Ast_cocci.attr,'a) ccode) -> ((Ast_cocci.top_level,'a) ccode) -> ((Ast_cocci.anything,'a) ccode) -> 'a combiner @@ -101,6 +103,7 @@ type rebuilder = rebuilder_parameter_list : Ast_cocci.parameter_list inout; rebuilder_statement : Ast_cocci.statement inout; rebuilder_case_line : Ast_cocci.case_line inout; + rebuilder_attribute : Ast_cocci.attr inout; rebuilder_rule_elem : Ast_cocci.rule_elem inout; rebuilder_top_level : Ast_cocci.top_level inout; rebuilder_expression_dots : Ast_cocci.expression Ast_cocci.dots inout; @@ -158,6 +161,7 @@ val rebuilder : (Ast_cocci.rule_elem rcode) -> (Ast_cocci.statement rcode) -> (Ast_cocci.case_line rcode) -> + (Ast_cocci.attr rcode) -> (Ast_cocci.top_level rcode) -> (Ast_cocci.anything rcode) -> rebuilder -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in parse_cocci.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/parse_cocci.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsing_cocci/parse_cocci.ml b/parsing_cocci/parse_cocci.ml index eb88c019..e455fce0 100644 --- a/parsing_cocci/parse_cocci.ml +++ b/parsing_cocci/parse_cocci.ml @@ -2620,7 +2620,7 @@ let contains_modifs ast = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing in + donothing donothing donothing donothing donothing in List.exists (function Ast.CocciRule(nm,infos,ast,_,_) -> -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in cleanup_rules.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/cleanup_rules.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsing_cocci/cleanup_rules.ml b/parsing_cocci/cleanup_rules.ml index 60452bec..7f03f98f 100644 --- a/parsing_cocci/cleanup_rules.ml +++ b/parsing_cocci/cleanup_rules.ml @@ -254,7 +254,7 @@ let do_cleanup = ident expression string_fragment string_format assignOp binaryOp fullType typeC initialiser parameterTypeDef define_param declaration donothing field ann_field donothing - rule_elem statement donothing donothing donothing + rule_elem statement donothing donothing donothing donothing let cleanup_rules rules d = dropped := d; -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in disjdistr.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/disjdistr.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/parsing_cocci/disjdistr.ml b/parsing_cocci/disjdistr.ml index ba2b8c02..93633e9c 100644 --- a/parsing_cocci/disjdistr.ml +++ b/parsing_cocci/disjdistr.ml @@ -483,6 +483,7 @@ let disj_all = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing disj_rule_elem donothing donothing donothing donothing + donothing (* ----------------------------------------------------------------------- *) (* collect iso information at the rule_elem level *) @@ -500,7 +501,7 @@ let collect_all_isos = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing doanything donothing doanything donothing donothing donothing donothing - donothing doanything + donothing donothing doanything let collect_iso_info = let mcode x = x in @@ -518,7 +519,7 @@ let collect_iso_info = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing rule_elem donothing donothing - donothing donothing + donothing donothing donothing (* ----------------------------------------------------------------------- *) -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in free_vars.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/free_vars.ml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/parsing_cocci/free_vars.ml b/parsing_cocci/free_vars.ml index 6ad35dcc..6958f48e 100644 --- a/parsing_cocci/free_vars.ml +++ b/parsing_cocci/free_vars.ml @@ -253,7 +253,7 @@ let collect_refs include_constraints = astfvident astfvexpr astfvfrag astfvfmt astfvassignop astfvbinaryop astfvfullType astfvtypeC astfvinit astfvparam astfvdefine_param astfvdecls donothing astfvfields astafvfields donothing - astfvrule_elem astfvstatement donothing donothing donothing_a + astfvrule_elem astfvstatement donothing donothing donothing donothing_a let collect_all_refs = collect_refs true let collect_non_constraint_refs = collect_refs false @@ -303,7 +303,7 @@ let collect_pos_positions = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - cprule_elem cpstmt donothing donothing donothing + cprule_elem cpstmt donothing donothing donothing donothing (* ---------------------------------------------------------------- *) @@ -479,7 +479,7 @@ let collect_saved = astfvident astfvexpr astfvfrag astfvfmt astfvassign astfvbinary donothing astfvtypeC astfvinit astfvparam astfvdefine_param astfvdecls donothing astfvfields donothing donothing astfvrule_elem donothing donothing - donothing donothing + donothing donothing donothing (* ---------------------------------------------------------------- *) @@ -612,7 +612,7 @@ let collect_in_plus_term = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing astfvrule_elem - astfvstatement donothing donothing donothing + astfvstatement donothing donothing donothing donothing let collect_in_plus metavars minirules = nub @@ -905,7 +905,7 @@ let classify_variables metavar_decls minirules used_after = ident expression string_fragment string_format assignop binaryop donothing typeC init param define_param decl donothing field donothing donothing - rule_elem donothing donothing donothing donothing in + rule_elem donothing donothing donothing donothing donothing in List.map fn.V.rebuilder_top_level minirules @@ -1091,7 +1091,8 @@ let astfvs metavars bound = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - astfvrule_elem astfvstatement astfvcase_line astfvtoplevel donothing + astfvrule_elem astfvstatement astfvcase_line donothing astfvtoplevel + donothing (* let collect_astfvs rules = @@ -1175,7 +1176,8 @@ let get_neg_pos_list (_,rule) used_after_list = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing donothing + donothing in match rule with Ast.CocciRule(rule_name,_,minirules,_,_) -> List.map -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in get_constants2.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/get_constants2.ml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/parsing_cocci/get_constants2.ml b/parsing_cocci/get_constants2.ml index d1d77f65..8fffe195 100644 --- a/parsing_cocci/get_constants2.ml +++ b/parsing_cocci/get_constants2.ml @@ -646,6 +646,7 @@ let do_get_constants constants keywords env (neg_pos,_) = ident expression string_fragment string_format donothing donothing fullType typeC initialiser parameter define_parameter declaration donothing field ann_field donothing rule_elem statement donothing donothing donothing + donothing (* ------------------------------------------------------------------------ *) @@ -714,7 +715,7 @@ let all_context = donothing donothing donothing donothing donothing donothing donothing donothing initialiser donothing donothing donothing donothing donothing donothing - donothing rule_elem statement donothing donothing donothing + donothing rule_elem statement donothing donothing donothing donothing (* ------------------------------------------------------------------------ *) -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in re_constraints.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/re_constraints.ml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/parsing_cocci/re_constraints.ml b/parsing_cocci/re_constraints.ml index 17011465..76ae85e6 100644 --- a/parsing_cocci/re_constraints.ml +++ b/parsing_cocci/re_constraints.ml @@ -44,7 +44,7 @@ let disj_free re = donothing donothing donothing donothing donothing donothing donothing ident expr donothing donothing donothing donothing ty donothing donothing donothing donothing decl donothing donothing ann_field donothing - rule_elem statement donothing donothing donothing in + rule_elem statement donothing donothing donothing donothing in try Hashtbl.find disj_free_table re with Not_found -> let res = v.V.combiner_rule_elem re in @@ -90,7 +90,8 @@ let ok_for_all_rule_elems cstr minirules = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing rule_elem donothing donothing donothing donothing in + donothing donothing rule_elem donothing donothing donothing donothing + donothing in List.for_all v.V.combiner_top_level minirules let update_for_all_rule_elems cstr minirules = @@ -113,7 +114,8 @@ let update_for_all_rule_elems cstr minirules = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing rule_elem donothing donothing donothing donothing in + donothing rule_elem donothing donothing donothing donothing + donothing in List.map v.V.rebuilder_top_level minirules let remove rule_name ((nm,_) as x) = -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in safe_for_multi_decls.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/safe_for_multi_decls.ml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parsing_cocci/safe_for_multi_decls.ml b/parsing_cocci/safe_for_multi_decls.ml index 70335abb..ee3741b9 100644 --- a/parsing_cocci/safe_for_multi_decls.ml +++ b/parsing_cocci/safe_for_multi_decls.ml @@ -43,7 +43,7 @@ let all_removed_recursor = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing - do_nothing do_nothing do_nothing do_nothing + do_nothing do_nothing do_nothing do_nothing do_nothing let all_removed_decl = all_removed_recursor.V.combiner_declaration @@ -100,7 +100,7 @@ let contains_modif = do_nothing do_nothing do_nothing init do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_fullType let attribute a = @@ -178,7 +178,7 @@ let process = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing decl anndecl field annfield - donothing donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing donothing in List.map fn.V.rebuilder_top_level let safe_for_multi_decls rules = -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in stmtlist.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/stmtlist.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsing_cocci/stmtlist.ml b/parsing_cocci/stmtlist.ml index 4e7a0b5a..56e54d0a 100644 --- a/parsing_cocci/stmtlist.ml +++ b/parsing_cocci/stmtlist.ml @@ -56,7 +56,7 @@ let stmtlist_rebuilder = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - statement donothing donothing donothing + statement donothing donothing donothing donothing let stmtlist rule = match rule with -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in unify_ast.ml. Also add a few fixes w/r/t the usage of for_all2 for comparing attributes. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_cocci/unify_ast.ml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/parsing_cocci/unify_ast.ml b/parsing_cocci/unify_ast.ml index 90cb70ee..98e2ab1d 100644 --- a/parsing_cocci/unify_ast.ml +++ b/parsing_cocci/unify_ast.ml @@ -221,7 +221,8 @@ and unify_expression e1 e2 = | (Ast.RecordPtAccess(e1,pt1,fld1),Ast.RecordPtAccess(e2,pt2,fld2)) -> unify_expression e1 e2 && unify_ident fld1 fld2 | (Ast.Cast(lp1,ty1,attr1,rp1,e1),Ast.Cast(lp2,ty2,attr2,rp2,e2)) -> - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ty1 ty2 && unify_expression e1 e2 else false | (Ast.SizeOfExpr(szf1,e1),Ast.SizeOfExpr(szf2,e2)) -> @@ -386,6 +387,7 @@ and unify_declaration d1 d2 = | (Ast.Init(stg1,ft1,id1,attr1,eq1,i1,s1), Ast.Init(stg2,ft2,id2,attr2,eq2,i2,s2)) -> if bool_unify_option unify_mcode stg1 stg2 && + (List.length attr1 = List.length attr2) && List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 && @@ -394,6 +396,7 @@ and unify_declaration d1 d2 = else false | (Ast.UnInit(stg1,ft1,id1,attr1,s1),Ast.UnInit(stg2,ft2,id2,attr2,s2)) -> if bool_unify_option unify_mcode stg1 stg2 && + (List.length attr1 = List.length attr2) && List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 && unify_ident id1 id2 else false @@ -414,6 +417,7 @@ and unify_declaration d1 d2 = | (Ast.MacroDecl(s1,n1,lp1,args1,rp1,attr1,sem1), Ast.MacroDecl(s2,n2,lp2,args2,rp2,attr2,sem2)) -> if bool_unify_option unify_mcode s1 s2 && + (List.length attr1 = List.length attr2) && List.for_all2 unify_attribute attr1 attr2 then unify_ident n1 n2 && @@ -428,7 +432,8 @@ and unify_declaration d1 d2 = unify_initialiser ini1 ini2 else false | (Ast.TyDecl(ft1,attr1,s1),Ast.TyDecl(ft2,attr2,s2)) -> - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 else false | (Ast.Typedef(stg1,ft1,id1,s1),Ast.Typedef(stg2,ft2,id2,s2)) -> @@ -549,12 +554,13 @@ and unify_designator d1 d2 = and unify_parameterTypeDef p1 p2 = match (Ast.unwrap p1,Ast.unwrap p2) with (Ast.VoidParam(ft1,attr1),Ast.VoidParam(ft2,attr2)) -> - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 else false | (Ast.Param(ft1,i1,attr1),Ast.Param(ft2,i2,attr2)) -> - - if List.for_all2 unify_attribute attr1 attr2 + if (List.length attr1 = List.length attr2) && + List.for_all2 unify_attribute attr1 attr2 then unify_fullType ft1 ft2 && unify_option unify_ident i1 i2 @@ -740,7 +746,7 @@ and subexp f = donothing expr donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing in recursor.V.combiner_rule_elem and subtype f = @@ -756,7 +762,7 @@ and subtype f = donothing donothing donothing donothing donothing donothing fullType donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing in + donothing donothing donothing in recursor.V.combiner_rule_elem let rec unify_statement s1 s2 = -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in unparse_hrule.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- parsing_c/unparse_hrule.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsing_c/unparse_hrule.ml b/parsing_c/unparse_hrule.ml index fca985ca..3078dde4 100644 --- a/parsing_c/unparse_hrule.ml +++ b/parsing_c/unparse_hrule.ml @@ -136,7 +136,7 @@ let get_function_name rule env = donothing donothing donothing donothing donothing donothing donothing donothing expression donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing + donothing donothing donothing donothing donothing donothing donothing donothing).V.combiner_top_level rule in match names with -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in cocci.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- cocci.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocci.ml b/cocci.ml index 3f315d4c..858c6672 100644 --- a/cocci.ml +++ b/cocci.ml @@ -600,7 +600,7 @@ let sp_contain_typed_metavar_z toplevel_list_list = donothing expression donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing + donothing donothing donothing in toplevel_list_list +> List.exists -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in asttoctl2.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- engine/asttoctl2.ml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/engine/asttoctl2.ml b/engine/asttoctl2.ml index 51d574fa..6f415c1c 100644 --- a/engine/asttoctl2.ml +++ b/engine/asttoctl2.ml @@ -344,7 +344,7 @@ let elim_opt = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing + donothing donothing (* --------------------------------------------------------------------- *) (* after management *) @@ -470,7 +470,7 @@ let contains_modif = do_nothing do_nothing do_nothing do_nothing init do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem let contains_pos = @@ -499,7 +499,7 @@ let contains_pos = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem (* code is not a DisjRuleElem *) @@ -598,7 +598,8 @@ let count_nested_braces s = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing stmt_count donothing donothing donothing in + donothing donothing donothing stmt_count donothing donothing donothing + donothing in let res = string_of_int (recursor.V.combiner_statement s) in string2var ("p"^res) @@ -2688,7 +2689,7 @@ and drop_minuses stmt_dots = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing donothing donothing donothing in + donothing donothing donothing donothing donothing donothing donothing donothing in v.V.rebuilder_statement_dots stmt_dots and find_xx = function -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in asttomember.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- engine/asttomember.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/asttomember.ml b/engine/asttomember.ml index a893a833..05896443 100644 --- a/engine/asttomember.ml +++ b/engine/asttomember.ml @@ -48,7 +48,7 @@ let contains_modif used_after x = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem x (* contains an inherited metavariable or contains a constant *) @@ -76,7 +76,7 @@ let contains_constant x = ident expr do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing - do_nothing do_nothing in + do_nothing do_nothing do_nothing in recursor.V.combiner_rule_elem x | _ -> true @@ -138,7 +138,7 @@ let strip x = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing decl_or_field do_absolutely_nothing decl_or_field do_absolutely_nothing do_nothing rule_elem - do_nothing do_nothing do_nothing do_absolutely_nothing in + do_nothing do_nothing do_nothing do_nothing do_absolutely_nothing in r.V.rebuilder_rule_elem x (* --------------------------------------------------------------------- *) @@ -205,7 +205,7 @@ let find_commonalities res : Ast_cocci.rule_elem option = do_nothing do_nothing expression do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing - do_nothing do_nothing do_nothing + do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing in recursor.V.combiner_rule_elem x in match res with -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in cocci_vs_c.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- engine/cocci_vs_c.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml index 9439cdb3..cba6c8d0 100644 --- a/engine/cocci_vs_c.ml +++ b/engine/cocci_vs_c.ml @@ -609,7 +609,7 @@ let check_allminus = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing + donothing donothing donothing donothing donothing (*****************************************************************************) (* Functor parameter combinators *) @@ -2335,7 +2335,7 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) = donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing donothing in + donothing donothing donothing donothing donothing in v.Visitor_ast.rebuilder_declaration decla in xs +> List.fold_left (fun acc var -> -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in transformation_c.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- engine/transformation_c.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/transformation_c.ml b/engine/transformation_c.ml index eecd4858..cb121a12 100644 --- a/engine/transformation_c.ml +++ b/engine/transformation_c.ml @@ -291,7 +291,7 @@ module XTRANS = struct ident expression donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing donothing - donothing donothing donothing in + donothing donothing donothing donothing in fn.Visitor_ast.rebuilder_anything anything -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
The SmPL AST visitor has a function for attributes. Reflect these changes in popltoctl.ml. Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com> --- popl09/popltoctl.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/popl09/popltoctl.ml b/popl09/popltoctl.ml index 1b05a762..da278168 100644 --- a/popl09/popltoctl.ml +++ b/popl09/popltoctl.ml @@ -48,7 +48,7 @@ let contains_modif = do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing rule_elem do_nothing do_nothing do_nothing - do_nothing in + do_nothing do_nothing in recursor.V.combiner_rule_elem let ctl_exists keep_wit v x = -- 2.21.3 _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci
On Thu, 16 Jul 2020, Jaskaran Singh wrote: > This patch series aims to add a public function for visiting attributes > to the SmPL AST visitor. This is needed to support meta attributes. Applied. Thanks. > > Jaskaran Singh (17): > parsing_cocci: visitor_ast: Add attributefn to SmPL AST visitor > parsing_cocci: parse_cocci: Reflect attributefn in AST visitor > parsing_cocci: cleanup_rules: Reflect attributefn in AST visitor > parsing_cocci: disjdistr: Reflect attributefn in AST visitor > parsing_cocci: free_vars: Reflect attributefn in AST visitor > parsing_cocci: get_constants2: Reflect attributefn in AST visitor > parsing_cocci: re_constraints: Reflect attributefn in AST visitor > parsing_cocci: safe_for_multi_decls: Reflect attributefn in AST visitor > parsing_cocci: stmtlist: Reflect attributefn in AST visitor > parsing_cocci: unify_ast: Reflect attributefn in AST visitor > parsing_c: unparse_hrule: Reflect attributefn in AST visitor > cocci: Reflect attributefn in AST visitor > engine: asttoctl2: Reflect attributefn in AST visitor > engine: asttomember: Reflect attributefn in AST visitor > engine: cocci_vs_c: Reflect attributefn in AST visitor > engine: transformation_c: Reflect attributefn in AST visitor > popl09: popltoctl: Reflect attributefn in AST visitor > > cocci.ml | 2 +- > engine/asttoctl2.ml | 11 ++++++----- > engine/asttomember.ml | 8 ++++---- > engine/cocci_vs_c.ml | 4 ++-- > engine/transformation_c.ml | 2 +- > parsing_c/unparse_hrule.ml | 2 +- > parsing_cocci/cleanup_rules.ml | 2 +- > parsing_cocci/disjdistr.ml | 5 +++-- > parsing_cocci/free_vars.ml | 16 +++++++++------- > parsing_cocci/get_constants2.ml | 3 ++- > parsing_cocci/parse_cocci.ml | 2 +- > parsing_cocci/re_constraints.ml | 8 +++++--- > parsing_cocci/safe_for_multi_decls.ml | 6 +++--- > parsing_cocci/stmtlist.ml | 2 +- > parsing_cocci/unify_ast.ml | 20 +++++++++++++------- > parsing_cocci/visitor_ast.ml | 12 ++++++++---- > parsing_cocci/visitor_ast.mli | 4 ++++ > popl09/popltoctl.ml | 2 +- > 18 files changed, 66 insertions(+), 45 deletions(-) > > > _______________________________________________ Cocci mailing list Cocci@systeme.lip6.fr https://systeme.lip6.fr/mailman/listinfo/cocci