Skip to contentSkip to conversation

parsing_c: Align C AST and Cocci AST for pointers

PATCH Markus Elfring 2 participants 2 messages Feb 5, 2020 – Feb 6, 2020

lore
Share & tools
lore
#0 lore raw

…

Quoted 5 lines

+++ b/parsing_c/pretty_print_c.ml

(quoted diff) +0 -0
@@ -804,11 +804,12 @@ and pp_string_format (e,ii) =
              (FunctionType (return=void, params=int i) *)
           (*WRONG I THINK, use left & right function *)
           (* bug: pp_type_with_ident_rest None t;      print_ident ident *)

Review and pp_string_format (e,ii) = · line 815

Quoted 10 lines
(quoted diff) +2 -1
+          pp_type_left t;
           pr_elem i;
           iiqu +> List.iter pr_elem; (* le const est forcement apres le '*' *)
           if iiqu <> [] || get_comments_after i <> []
           then pr_space();
-          pp_type_with_ident_rest ident t attrs Ast_c.noattr;
+          print_ident ident
 
       (* ugly special case ... todo? maybe sufficient in practice *)
       | (ParenType ttop, [i1;i2]) ->

Are the source code comments still appropriate for this patch hunk?

Regards,
Markus
_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

#1 lore raw
Quoted 16 lines · Markus Elfring

…

Quoted 15 lines

+++ b/parsing_c/pretty_print_c.ml

(quoted diff) +2 -1
@@ -804,11 +804,12 @@ and pp_string_format (e,ii) =
              (FunctionType (return=void, params=int i) *)
           (*WRONG I THINK, use left & right function *)
           (* bug: pp_type_with_ident_rest None t;      print_ident
 ident *)
+          pp_type_left t;
           pr_elem i;
           iiqu +> List.iter pr_elem; (* le const est forcement
 apres le '*' *)
           if iiqu <> [] || get_comments_after i <> []
           then pr_space();
-          pp_type_with_ident_rest ident t attrs Ast_c.noattr;
+          print_ident ident
 
Quoted 6 lines
Quoted 3 lines

(* ugly special case ... todo? maybe sufficient in practice
*)

       | (ParenType ttop, [i1;i2]) ->

Are the source code comments still appropriate for this patch hunk?

I know the "le const est forcement" comment is still appropriate.

The bug comment above probably still is.

Not so sure about the WRONG I THINK comment. I'm using pp_type_left here, but not pp_type_right. Of course, that is if the comment is in that context.

Cheers,
Jaskaran.

Quoted 2 lines

Regards,
Markus

_______________________________________________
Linux-kernel-mentees mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees