MetaAttributeVal is added to the C AST. Reflect these changes in
pretty_print_engine.ml.

Signed-off-by: Jaskaran Singh <jaskaran.si...@collabora.com>
---
 engine/pretty_print_engine.ml |  1 +
 parsing_c/pretty_print_c.ml   | 12 ++++++++++++
 parsing_c/pretty_print_c.mli  |  5 +++++
 3 files changed, 18 insertions(+)

diff --git a/engine/pretty_print_engine.ml b/engine/pretty_print_engine.ml
index 383016ce3..b825fac39 100644
--- a/engine/pretty_print_engine.ml
+++ b/engine/pretty_print_engine.ml
@@ -42,6 +42,7 @@ let rec pp_binding_kind = function
   | Ast_c.MetaStmtListVal      (statxs,_) ->
       Pretty_print_c.pp_statement_seq_list_simple statxs
   | Ast_c.MetaFmtVal fmt -> Pretty_print_c.pp_string_format_simple fmt
+  | Ast_c.MetaAttributeVal attr -> Pretty_print_c.pp_attribute_simple attr
   | Ast_c.MetaFragListVal frags ->
       frags +> (List.iter Pretty_print_c.pp_string_fragment_simple)
   | Ast_c.MetaParamVal     params -> pp "<<param>>"
diff --git a/parsing_c/pretty_print_c.ml b/parsing_c/pretty_print_c.ml
index 74b57344e..6ac3e4767 100644
--- a/parsing_c/pretty_print_c.ml
+++ b/parsing_c/pretty_print_c.ml
@@ -55,6 +55,7 @@ type pretty_printers = {
   fragment        : Ast_c.string_fragment printer;
   fragment_list   : (Ast_c.string_fragment list) printer;
   format          : Ast_c.string_format printer;
+  attribute       : Ast_c.attribute printer;
   flow            : Control_flow_c.node printer;
   name            : Ast_c.name printer
 }
@@ -1145,6 +1146,12 @@ and pp_init (init, iinit) =
       ii +> List.iter pr_elem;
     );
 
+  and pp_attribute (e,ii) =
+    match (e,ii) with
+      Attribute(a), ii  ->
+        let (i) = Common.tuple_of_list1 ii in
+        pr_elem i
+
 (* ---------------------- *)
   and pp_def_start defbis iifunc1 iifunc2 ifakestart isto =
     let {f_name = name;
@@ -1524,6 +1531,7 @@ and pp_init (init, iinit) =
     toplevel   = pp_toplevel;
     fragment   = pp_string_fragment;
     fragment_list = pp_string_fragment_list;
+    attribute  = pp_attribute;
     format     = pp_string_format;
     flow       = pp_flow;
     name       = pp_name;
@@ -1583,6 +1591,7 @@ let pp_init_simple       = ppc.init
 let pp_toplevel_simple   = ppc.toplevel
 let pp_string_fragment_simple = ppc.fragment
 let pp_string_format_simple = ppc.format
+let pp_attribute_simple  = ppc.attribute
 let pp_flow_simple       = ppc.flow
 let pp_name              = ppc.name
 
@@ -1649,6 +1658,9 @@ let pp_string_fragment_list_gen ~pr_elem ~pr_space =
 let pp_string_format_gen ~pr_elem ~pr_space =
   (pp_elem_sp pr_elem pr_space).format
 
+let pp_attribute_gen ~pr_elem ~pr_space =
+  (pp_elem_sp pr_elem pr_space).attribute
+
 let pp_program_gen ~pr_elem ~pr_space =
   (pp_elem_sp pr_elem pr_space).toplevel
 
diff --git a/parsing_c/pretty_print_c.mli b/parsing_c/pretty_print_c.mli
index 5cfcc779d..daaad2061 100644
--- a/parsing_c/pretty_print_c.mli
+++ b/parsing_c/pretty_print_c.mli
@@ -26,6 +26,7 @@ type pretty_printers = {
   fragment        : Ast_c.string_fragment printer;
   fragment_list   : (Ast_c.string_fragment list) printer;
   format          : Ast_c.string_format printer;
+  attribute       : Ast_c.attribute printer;
   flow            : Control_flow_c.node printer;
   name            : Ast_c.name printer
 }
@@ -80,6 +81,9 @@ val pp_string_fragment_list_gen:
 val pp_string_format_gen:
     pr_elem:Ast_c.info printer -> pr_space:unit printer ->
       Ast_c.string_format printer
+val pp_attribute_gen:
+    pr_elem:Ast_c.info printer -> pr_space:unit printer ->
+      Ast_c.attribute printer
 val pp_program_gen : pr_elem:Ast_c.info printer -> pr_space:unit printer ->
   Ast_c.toplevel printer
 
@@ -98,6 +102,7 @@ val pp_statement_seq_list_simple: 
Ast_c.statement_sequencable list printer
 val pp_toplevel_simple:   Ast_c.toplevel printer
 val pp_string_fragment_simple:   Ast_c.string_fragment printer
 val pp_string_format_simple:     Ast_c.string_format printer
+val pp_attribute_simple:     Ast_c.attribute printer
 
 val debug_info_of_node:
   Control_flow_c.G.key -> Control_flow_c.cflow -> string
-- 
2.21.3

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

Reply via email to