linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: julia.lawall@inria.fr, jaskaransingh7654321@gmail.com,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Linux-kernel-mentees] [PATCH 04/23] parsing_cocci: arity: Reflect Parameter attributes
Date: Mon, 27 Apr 2020 17:38:15 +0530	[thread overview]
Message-ID: <20200427120834.380-5-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200427120834.380-1-jaskaransingh7654321@gmail.com>

Parameter attributes are added to the SmPL AST. Reflect these changes in
arity.ml.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
 parsing_cocci/arity.ml | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/parsing_cocci/arity.ml b/parsing_cocci/arity.ml
index 8ee6d33f..0f64c113 100644
--- a/parsing_cocci/arity.ml
+++ b/parsing_cocci/arity.ml
@@ -812,26 +812,29 @@ and make_param =
 and parameterTypeDef tgt param =
   let param_same = all_same true tgt in
   match Ast0.unwrap param with
-    Ast0.VoidParam(ty) -> Ast0.rewrap param (Ast0.VoidParam(typeC tgt ty))
-  | Ast0.Param(ty,Some id) ->
+    Ast0.VoidParam(ty,attr) ->
+      Ast0.rewrap param (Ast0.VoidParam(typeC tgt ty,List.map mcode attr))
+  | Ast0.Param(ty,Some id,attr) ->
       let ty = top_typeC tgt true ty in
       let id = ident true tgt id in
+      let attr = List.map mcode attr in
       Ast0.rewrap param
 	(match (Ast0.unwrap ty,Ast0.unwrap id) with
 	  (Ast0.OptType(ty),Ast0.OptIdent(id)) ->
-	    Ast0.OptParam(Ast0.rewrap param (Ast0.Param(ty,Some id)))
+	    Ast0.OptParam(Ast0.rewrap param (Ast0.Param(ty,Some id,attr)))
 	| (Ast0.OptType(ty),_) ->
 	    fail param "arity mismatch in param declaration"
 	| (_,Ast0.OptIdent(id)) ->
 	    fail param "arity mismatch in param declaration"
-	| _ -> Ast0.Param(ty,Some id))
-  | Ast0.Param(ty,None) ->
+	| _ -> Ast0.Param(ty,Some id,attr))
+  | Ast0.Param(ty,None,attr) ->
       let ty = top_typeC tgt true ty in
+      let attr = List.map mcode attr in
       Ast0.rewrap param
 	(match Ast0.unwrap ty with
 	  Ast0.OptType(ty) ->
-	    Ast0.OptParam(Ast0.rewrap param (Ast0.Param(ty,None)))
-	| _ -> Ast0.Param(ty,None))
+	    Ast0.OptParam(Ast0.rewrap param (Ast0.Param(ty,None,attr)))
+	| _ -> Ast0.Param(ty,None,attr))
   | Ast0.MetaParam(name,cstr,pure) ->
       let arity = param_same (mcode2line name) [mcode2arity name] in
       let name = mcode name in
-- 
2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  parent reply	other threads:[~2020-04-27 12:09 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27 12:08 [Linux-kernel-mentees] [PATCH 00/23] cocci: Add parameter attributes to SmPL Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 01/23] parsing_cocci: ast0_cocci: Add parameter attributes Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 02/23] parsing_cocci: parser: Parse Parameter attributes Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 03/23] parsing_cocci: visitor_ast0: Visit " Jaskaran Singh
2020-04-27 12:08 ` Jaskaran Singh [this message]
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 05/23] parsing_cocci: check_meta: Reflect " Jaskaran Singh
2020-04-27 17:00   ` Julia Lawall
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 06/23] parsing_cocci: compute_lines: " Jaskaran Singh
2020-04-27 17:03   ` Julia Lawall
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 07/23] parsing_cocci: context_neg: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 08/23] parsing_cocci: function_prototypes: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 09/23] parsing_cocci: index: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 10/23] parsing_cocci: iso_pattern: " Jaskaran Singh
2020-04-27 17:06   ` Julia Lawall
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 11/23] parsing_cocci: type_infer: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 12/23] parsing_cocci: unparse_ast0: " Jaskaran Singh
2020-04-27 17:09   ` Julia Lawall
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 13/23] parsing_c: unparse_cocci: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 14/23] parsing_cocci: ast_cocci: Add " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 15/23] parsing_cocci: visitor_ast: Visit " Jaskaran Singh
2020-04-27 17:13   ` Julia Lawall
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 16/23] parsing_cocci: ast0toast: Reflect " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 17/23] parsing_cocci: disjdistr: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 18/23] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 19/23] parsing_cocci: unify_ast: " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 20/23] engine: cocci_vs_c: Match " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 21/23] ocaml: coccilib: Reflect " Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 22/23] tests: Add test case for removing parameter attributes Jaskaran Singh
2020-04-27 17:31   ` Julia Lawall
2020-04-28 12:43     ` Jaskaran Singh
2020-04-27 12:08 ` [Linux-kernel-mentees] [PATCH 23/23] tests: Add test case to detect " Jaskaran Singh
2020-04-27 12:21 ` [Linux-kernel-mentees] [PATCH v2 08/23] parsing_cocci: function_prototypes: Reflect Parameter attributes 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=20200427120834.380-5-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.fr \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    /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).