[Linux-kernel-mentees] [PATCH 08/27] parsing_cocci: arity: Reflect struct end attributes

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


Struct end 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 | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/parsing_cocci/arity.ml b/parsing_cocci/arity.ml
index cbfb84e3..6f90616e 100644
--- a/parsing_cocci/arity.ml
+++ b/parsing_cocci/arity.ml
@@ -624,12 +624,14 @@ and declaration tgt decl =
       let sem = mcode sem in
       make_decl decl tgt arity
 	(Ast0.MacroDeclInit(stg,name,lp,args,rp,eq,ini,sem))
-  | Ast0.TyDecl(ty,sem) ->
+  | Ast0.TyDecl(ty,attr,sem) ->
       let arity =
-	all_same true tgt (mcode2line sem) [mcode2arity sem] in
+        all_same true tgt
+          (mcode2line sem) (List.map mcode2arity (attr @ [sem])) in
       let ty = typeC arity ty in
+      let attr = List.map mcode attr in
       let sem = mcode sem in
-      make_decl decl tgt arity (Ast0.TyDecl(ty,sem))
+      make_decl decl tgt arity (Ast0.TyDecl(ty,attr,sem))
   | Ast0.Typedef(stg,ty,id,sem) ->
       let arity =
 	all_same true tgt (mcode2line sem)
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list