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 26/30] engine: cocci_vs_c: Match Macrodecl attributes
Date: Sun, 24 May 2020 22:49:31 +0530 [thread overview]
Message-ID: <20200524171935.2504-27-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200524171935.2504-1-jaskaransingh7654321@gmail.com>
Macrodecl attributes are added to the C and SmPL ASTs. Match these
attributes in cocci_vs_c.ml.
Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
engine/cocci_vs_c.ml | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml
index 317fa71e..ca911765 100644
--- a/engine/cocci_vs_c.ml
+++ b/engine/cocci_vs_c.ml
@@ -2340,8 +2340,8 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) =
fail
end
- | A.MacroDecl (stoa,sa,lpa,eas,rpa,enda),
- B.MacroDecl ((stob,sb,ebs,true),ii) ->
+ | A.MacroDecl (stoa,sa,lpa,eas,rpa,attrsa,enda),
+ B.MacroDecl ((stob,sb,ebs,attrsb,true),ii) ->
let (iisb, lpb, rpb, iiendb, iifakestart, iistob) =
(match ii with
| iisb::lpb::rpb::iiendb::iifakestart::iisto ->
@@ -2352,6 +2352,7 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) =
stoa ((stob, false), iistob) >>= (fun stoa ((stob, _), iistob) ->
X.tokenf_mck mckstart iifakestart >>= (fun mckstart iifakestart ->
ident DontKnow sa (sb, iisb) >>= (fun sa (sb, iisb) ->
+ attribute_list allminus attrsa attrsb >>= (fun attrsa attrsb ->
tokenf lpa lpb >>= (fun lpa lpb ->
tokenf rpa rpb >>= (fun rpa rpb ->
tokenf enda iiendb >>= (fun enda iiendb ->
@@ -2360,13 +2361,13 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) =
return (
(mckstart, allminus,
- (A.MacroDecl (stoa,sa,lpa,eas,rpa,enda)) +> A.rewrap decla),
- (B.MacroDecl ((stob,sb,ebs,true),
+ (A.MacroDecl (stoa,sa,lpa,eas,rpa,attrsa,enda)) +> A.rewrap decla),
+ (B.MacroDecl ((stob,sb,ebs,attrsb,true),
[iisb;lpb;rpb;iiendb;iifakestart] @ iistob))
- ))))))))
+ )))))))))
- | A.MacroDecl (None,sa,lpa,eas,rpa,enda),
- B.MacroDecl ((B.NoSto,sb,ebs,false),ii) ->
+ | A.MacroDecl (None,sa,lpa,eas,rpa,attrsa,enda),
+ B.MacroDecl ((B.NoSto,sb,ebs,attrsb,false),ii) ->
(* This is for macrodecls with no semicolons, which come from
a parsing rule that deals with function prototypes with no
return type. That parsing rule would have a conflict if there
@@ -2383,6 +2384,7 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) =
X.tokenf_mck mckstart iifakestart >>=
(fun mckstart iifakestart ->
ident DontKnow sa (sb, iisb) >>= (fun sa (sb, iisb) ->
+ attribute_list allminus attrsa attrsb >>= (fun attrsa attrsb ->
tokenf lpa lpb >>= (fun lpa lpb ->
tokenf rpa rpb >>= (fun rpa rpb ->
arguments (seqstyle eas) (A.unwrap eas) ebs >>=
@@ -2391,10 +2393,11 @@ and (declaration: (A.mcodekind * bool * A.declaration,B.declaration) matcher) =
return (
(mckstart, allminus,
- (A.MacroDecl (None,sa,lpa,eas,rpa,enda)) +> A.rewrap decla),
- (B.MacroDecl ((B.NoSto,sb,ebs,false),
+ (A.MacroDecl
+ (None,sa,lpa,eas,rpa,attrsa,enda)) +> A.rewrap decla),
+ (B.MacroDecl ((B.NoSto,sb,ebs,attrsb,false),
[iisb;lpb;rpb;iifakestart]))
- ))))))
+ )))))))
| _ -> fail)
| A.MacroDeclInit (stoa,sa,lpa,eas,rpa,weqa,inia,enda),
--
2.21.1
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees
next prev parent reply other threads:[~2020-05-24 17:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-24 17:19 [Linux-kernel-mentees] [PATCH 00/30] cocci: Add macrodecl attributes to C and SmPL ASTs Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 01/30] parsing_cocci: ast0_cocci: Add Macrodecl attributes Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 02/30] parsing_cocci: parser: Parse " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 03/30] parsing_cocci: visitor_ast0: Visit " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 04/30] parsing_cocci: unparse_ast0: Reflect " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 05/30] parsing_cocci: index: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 06/30] parsing_cocci: iso_pattern: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 07/30] parsing_cocci: type_infer: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 08/30] parsing_cocci: arity: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 09/30] parsing_cocci: check_meta: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 10/30] parsing_cocci: compute_lines: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 11/30] parsing_cocci: context_neg: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 12/30] parsing_cocci: single_statement: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 13/30] parsing_cocci: ast_cocci: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 14/30] parsing_cocci: visitor_ast: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 15/30] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 16/30] parsing_cocci: disjdistr: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 17/30] parsing_cocci: adjust_pragmas: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 18/30] parsing_cocci: unify_ast: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 19/30] parsing_cocci: ast0toast: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 20/30] parsing_c: ast_c: Add " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 21/30] parsing_c: parser_c: Reflect " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 22/30] parsing_c: visitor_c: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 23/30] parsing_c: pretty_print_c: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 24/30] parsing_c: unparse_cocci: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 25/30] engine: check_exhaustive_pattern: " Jaskaran Singh
2020-05-24 17:19 ` Jaskaran Singh [this message]
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 27/30] ocaml: coccilib: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 28/30] tools: spgen: " Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 29/30] tests: Add test case to remove macrodecl attributes Jaskaran Singh
2020-05-24 17:19 ` [Linux-kernel-mentees] [PATCH 30/30] tests: Add test case to detect a macrodecl attribute 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=20200524171935.2504-27-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).