[Linux-kernel-mentees] [PATCH 20/27] parsing_c: unparse_cocci: Reflect struct end attributes

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


Struct end attributes are added to the SmPL AST. Reflect these changes
in unparse_cocci.ml.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
 parsing_c/unparse_cocci.ml | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml
index 30050ea1..f0efc968 100644
--- a/parsing_c/unparse_cocci.ml
+++ b/parsing_c/unparse_cocci.ml
@@ -955,7 +955,11 @@ and declaration d =
       close_box(); mcode print_string rp;
       pr_space(); mcode print_string eq;
       pr_space(); initialiser true ini; mcode print_string sem
-  | Ast.TyDecl(ty,sem) -> fullType ty; mcode print_string sem
+  | Ast.TyDecl(ty,attr,sem) ->
+      fullType ty;
+      (if not (attr = []) then pr_space());
+      print_between pr_space (mcode print_string) attr;
+      mcode print_string sem
   | Ast.Typedef(stg,ty,id,sem) ->
       mcode print_string stg; pr_space();
       print_named_type ty (fun _ -> typeC id);
-- 
2.21.1



More information about the Linux-kernel-mentees mailing list