[Linux-kernel-mentees] [PATCH v3 13/23] parsing_c: unparse_cocci: Reflect Parameter attributes
Jaskaran Singh
jaskaransingh7654321 at gmail.com
Mon May 11 10:12:50 UTC 2020
Parameter attributes are added to the SmPL AST. Print these attributes
correctly in unparse_cocci.ml.
Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
parsing_c/unparse_cocci.ml | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml
index 395b3a3c..d3f97bf7 100644
--- a/parsing_c/unparse_cocci.ml
+++ b/parsing_c/unparse_cocci.ml
@@ -1089,10 +1089,18 @@ and designator = function
and parameterTypeDef p =
match Ast.unwrap p with
- Ast.VoidParam(ty) -> fullType ty
- | Ast.Param(ty,Some id) -> print_named_type ty (fun _ -> ident id)
- | Ast.Param(ty,None) -> fullType ty
-
+ Ast.VoidParam(ty,attr) ->
+ fullType ty;
+ (if not (attr = []) then pr_space());
+ print_between pr_space (mcode print_string) attr;
+ | Ast.Param(ty,Some id,attr) ->
+ print_named_type ty (fun _ -> ident id);
+ (if not (attr = []) then pr_space());
+ print_between pr_space (mcode print_string) attr;
+ | Ast.Param(ty,None,attr) ->
+ fullType ty;
+ (if not (attr = []) then pr_space());
+ print_between pr_space (mcode print_string) attr;
| Ast.MetaParam(name,_,_,_) ->
handle_metavar name
(function
--
2.21.1
More information about the Linux-kernel-mentees
mailing list