cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaran.singh@collabora.com>
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH 14/43] engine: pretty_print_engine: Add MetaAttributeVal
Date: Sun, 26 Jul 2020 18:21:12 +0530	[thread overview]
Message-ID: <20200726125141.17787-15-jaskaran.singh@collabora.com> (raw)
In-Reply-To: <20200726125141.17787-1-jaskaran.singh@collabora.com>

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@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

  parent reply	other threads:[~2020-07-26 12:52 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
2020-07-26 12:50 ` [Cocci] [PATCH 01/43] parsing_cocci: ast0_cocci: Add MetaAttribute & MetaAttributeDecl Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 02/43] parsing_cocci: parser: Parse meta attributes and metaattr decls Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 03/43] parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 04/43] parsing_cocci: ast_cocci: Add " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 05/43] parsing_cocci: iso_pattern: Reflect " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 06/43] parsing_c: unparse_hrule: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 07/43] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 08/43] ocaml: coccilib: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 09/43] ocaml: yes_prepare_ocamlcocci: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 10/43] parsing_c: ast_c: Add MetaAttributeVal Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 11/43] parsing_c: unparse_hrule: Reflect MetaAttributeVal Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 12/43] engine: cocci_vs_c: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 13/43] engine: pattern_c: " Jaskaran Singh
2020-07-26 12:51 ` Jaskaran Singh [this message]
2020-07-26 12:51 ` [Cocci] [PATCH 15/43] ocaml: coccilib: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 16/43] ocaml: ocamlcocci_aux: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 17/43] ocaml: run_ocamlcocci: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 18/43] python: pycocci_aux: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 19/43] parsing_cocci: visitor_ast0: Reflect MetaAttribute Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 20/43] parsing_cocci: check_meta: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 21/43] parsing_cocci: adjust_pragmas: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 22/43] parsing_cocci: context_neg: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 23/43] parsing_cocci: compute_lines: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 24/43] parsing_cocci: iso_pattern: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 25/43] parsing_cocci: function_prototypes: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 26/43] parsing_cocci: arity: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 27/43] parsing_cocci: unitary_ast0: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 28/43] parsing_cocci: unparse_ast0: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 29/43] parsing_cocci: ast0toast: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 30/43] parsing_cocci: visitor_ast: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 31/43] parsing_cocci: cleanup_rules: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 32/43] parsing_cocci: free_vars: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 33/43] parsing_cocci: get_constants: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 34/43] parsing_cocci: get_constants2: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 35/43] parsing_cocci: index: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 36/43] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 37/43] parsing_cocci: safe_for_multi_decls: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 38/43] parsing_cocci: unify_ast: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 39/43] parsing_c: unparse_cocci: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 40/43] engine: cocci_vs_c: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 41/43] tools: spgen: " Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 43/43] tests: Add test case to remove a " Jaskaran Singh
2020-08-01 20:36 ` [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Julia Lawall
2020-08-02 12:16   ` Jaskaran Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200726125141.17787-15-jaskaran.singh@collabora.com \
    --to=jaskaran.singh@collabora.com \
    --cc=cocci@systeme.lip6.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).