[Linux-kernel-mentees] [PATCH 06/27] parsing_cocci: iso_pattern: Reflect struct end attributes

Jaskaran Singh jaskaransingh7654321 at gmail.com
Sun May 31 15:26:00 UTC 2020


Struct end 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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml
index 5b4c5f61..6cd5f1cb 100644
--- a/parsing_cocci/iso_pattern.ml
+++ b/parsing_cocci/iso_pattern.ml
@@ -998,8 +998,13 @@ let match_maker checks_needed context_required whencode_allowed =
 		       argsa argsb;
 		     match_init ini1 ini]
 	       else return false
-	  | (Ast0.TyDecl(tya,sc1),Ast0.TyDecl(tyb,sc)) ->
-	      conjunct_bindings (check_mcode sc1 sc) (match_typeC tya tyb)
+	  | (Ast0.TyDecl(tya,attra,sc1),Ast0.TyDecl(tyb,attrb,sc)) ->
+	      if (List.length attra = List.length attrb &&
+                  List.fold_left2 (fun p a b -> p && mcode_equal a b) true
+                    attra attrb) (* no metavars *)
+              then
+	        conjunct_bindings (check_mcode sc1 sc) (match_typeC tya tyb)
+              else return false
 	  | (Ast0.Typedef(stga,tya,ida,sc1),Ast0.Typedef(stgb,tyb,idb,sc)) ->
 	      conjunct_bindings (check_mcode sc1 sc)
 		(conjunct_bindings (match_typeC tya tyb) (match_typeC ida idb))
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list