Re: [Cocci] [PATCH 22/32] parsing_c: pretty_print_c: Reflect Cast attributes

2020-05-03 Thread Julia Lawall



On Tue, 28 Apr 2020, Jaskaran Singh wrote:

> Cast attributes are added to the SmPL AST. Print these attributes in
> pretty_print_c.ml.
>
> Signed-off-by: Jaskaran Singh 
> ---
>  parsing_c/pretty_print_c.ml | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/parsing_c/pretty_print_c.ml b/parsing_c/pretty_print_c.ml
> index 99a7e0ed..96a11d72 100644
> --- a/parsing_c/pretty_print_c.ml
> +++ b/parsing_c/pretty_print_c.ml
> @@ -146,8 +146,9 @@ let mk_pretty_printers
>   pp_expression e
>  | SizeOfType  (t), [i1;i2;i3] ->
>  pr_elem i1; pr_elem i2; pp_type t; pr_elem i3
> -| Cast(t, e),  [i1;i2] ->
> -pr_elem i1; pp_type t; pr_elem i2; pp_expression e
> +| Cast(t, e, a),  [i1;i2] ->

Less space in front of the [

julia

> +pr_elem i1; pp_type t; pr_elem i2; pp_expression e;
> +a +> pp_attributes pr_elem pr_space
>
>  | StatementExpr (statxs, [ii1;ii2]),  [i1;i2] ->
>  pr_elem i1;
> @@ -184,7 +185,7 @@ let mk_pretty_printers
>  | CondExpr (_,_,_) | Sequence (_,_) | Assignment (_,_,_)
>  | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_)
>  | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_)
> -| SizeOfExpr (_) | SizeOfType (_) | Cast (_,_)
> +| SizeOfExpr (_) | SizeOfType (_) | Cast (_,_,_)
>  | StatementExpr (_) | Constructor _
>  | ParenExpr (_) | New (_) | Delete (_,_)
>  | Defined (_)),_ -> raise (Impossible 95)
> --
> 2.21.1
>
>
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH 22/32] parsing_c: pretty_print_c: Reflect Cast attributes

2020-04-28 Thread Jaskaran Singh
Cast attributes are added to the SmPL AST. Print these attributes in
pretty_print_c.ml.

Signed-off-by: Jaskaran Singh 
---
 parsing_c/pretty_print_c.ml | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/parsing_c/pretty_print_c.ml b/parsing_c/pretty_print_c.ml
index 99a7e0ed..96a11d72 100644
--- a/parsing_c/pretty_print_c.ml
+++ b/parsing_c/pretty_print_c.ml
@@ -146,8 +146,9 @@ let mk_pretty_printers
pp_expression e
 | SizeOfType  (t), [i1;i2;i3] ->
 pr_elem i1; pr_elem i2; pp_type t; pr_elem i3
-| Cast(t, e),  [i1;i2] ->
-pr_elem i1; pp_type t; pr_elem i2; pp_expression e
+| Cast(t, e, a),  [i1;i2] ->
+pr_elem i1; pp_type t; pr_elem i2; pp_expression e;
+a +> pp_attributes pr_elem pr_space
 
 | StatementExpr (statxs, [ii1;ii2]),  [i1;i2] ->
 pr_elem i1;
@@ -184,7 +185,7 @@ let mk_pretty_printers
 | CondExpr (_,_,_) | Sequence (_,_) | Assignment (_,_,_)
 | Postfix (_,_) | Infix (_,_) | Unary (_,_) | Binary (_,_,_)
 | ArrayAccess (_,_) | RecordAccess (_,_) | RecordPtAccess (_,_)
-| SizeOfExpr (_) | SizeOfType (_) | Cast (_,_)
+| SizeOfExpr (_) | SizeOfType (_) | Cast (_,_,_)
 | StatementExpr (_) | Constructor _
 | ParenExpr (_) | New (_) | Delete (_,_)
 | Defined (_)),_ -> raise (Impossible 95)
-- 
2.21.1

___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci