[Linux-kernel-mentees] [PATCH v2 24/32] parsing_c: unparse_cocci: Reflect Cast attributes
Jaskaran Singh
jaskaransingh7654321 at gmail.com
Mon May 11 10:07:07 UTC 2020
Cast 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, 4 insertions(+), 2 deletions(-)
diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml
index 395b3a3c..0c95c35e 100644
--- a/parsing_c/unparse_cocci.ml
+++ b/parsing_c/unparse_cocci.ml
@@ -455,7 +455,7 @@ let rec expression e =
| Ast_c.RecordPtAccess (e, name) -> postfix
| Ast_c.SizeOfExpr (e) -> unary
| Ast_c.SizeOfType (t) -> unary
- | Ast_c.Cast (t, e) -> cast
+ | Ast_c.Cast (t, a, e) -> cast
| Ast_c.StatementExpr (statxs, _) -> top
| Ast_c.Constructor (t, init) -> unary
| Ast_c.ParenExpr (e) -> primary
@@ -503,8 +503,10 @@ let rec expression e =
loop exp postfix; mcode print_string pt; ident field
| Ast.RecordPtAccess(exp,ar,field) ->
loop exp postfix; mcode print_string ar; ident field
- | Ast.Cast(lp,ty,rp,exp) ->
+ | Ast.Cast(lp,ty,attr,rp,exp) ->
mcode print_string_box lp; fullType ty; close_box();
+ (if not (attr = []) then pr_space());
+ print_between pr_space (mcode print_string) attr;
mcode print_string rp; loop exp cast
| Ast.SizeOfExpr(sizeof,exp) ->
mcode print_string sizeof; loop exp unary
--
2.21.1
More information about the Linux-kernel-mentees
mailing list