From: Jaskaran Singh <jaskaran.singh@collabora.com>
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH 20/43] parsing_cocci: check_meta: Reflect MetaAttribute
Date: Sun, 26 Jul 2020 18:21:18 +0530 [thread overview]
Message-ID: <20200726125141.17787-21-jaskaran.singh@collabora.com> (raw)
In-Reply-To: <20200726125141.17787-1-jaskaran.singh@collabora.com>
MetaAttribute is added to the SmPL AST. Reflect these changes in
check_meta.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/check_meta.ml | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/parsing_cocci/check_meta.ml b/parsing_cocci/check_meta.ml
index 342cbd87f..fb8d05ccc 100644
--- a/parsing_cocci/check_meta.ml
+++ b/parsing_cocci/check_meta.ml
@@ -173,8 +173,9 @@ let rec expression context old_metas table minus e =
expression ID old_metas table minus exp;
ident FIELD old_metas table minus field
| Ast0.Cast(lp,ty,attr,rp,exp) ->
- (* No meta attribute yet *)
- typeC old_metas table minus ty; expression ID old_metas table minus exp
+ typeC old_metas table minus ty;
+ List.iter (attribute old_metas table minus) attr;
+ expression ID old_metas table minus exp
| Ast0.SizeOfExpr(szf,exp) -> expression ID old_metas table minus exp
| Ast0.SizeOfType(szf,lp,ty,rp) -> typeC old_metas table minus ty
| Ast0.TypeExp(ty) -> typeC old_metas table minus ty
@@ -266,6 +267,7 @@ and declaration context old_metas table minus d =
| Ast0.Init(stg,ty,id,attr,eq,ini,sem) ->
typeC old_metas table minus ty;
ident context old_metas table minus id;
+ List.iter (attribute old_metas table minus) attr;
(match Ast0.unwrap ini with
Ast0.InitExpr exp ->
expression ID old_metas table minus exp
@@ -277,14 +279,15 @@ and declaration context old_metas table minus d =
else*)
initialiser old_metas table minus ini)
| Ast0.UnInit(stg,ty,id,attr,sem) ->
- typeC old_metas table minus ty; ident context old_metas table minus id
+ typeC old_metas table minus ty; ident context old_metas table minus id;
+ List.iter (attribute old_metas table minus) attr
| Ast0.FunProto(fi,name,lp1,params,va,rp1,sem) ->
ident FN old_metas table minus name;
List.iter (fninfo old_metas table minus) fi;
parameter_list old_metas table minus params
| Ast0.MacroDecl(stg,name,lp,args,rp,attr,sem) ->
- (* no meta attribute yet *)
ident GLOBAL old_metas table minus name;
+ List.iter (attribute old_metas table minus) attr;
dots (expression ID old_metas table minus) args
| Ast0.MacroDeclInit(stg,name,lp,args,rp,eq,ini,sem) ->
ident GLOBAL old_metas table minus name;
@@ -292,7 +295,9 @@ and declaration context old_metas table minus d =
(match Ast0.unwrap ini with
Ast0.InitExpr exp -> expression ID old_metas table minus exp
| _ -> initialiser old_metas table minus ini)
- | Ast0.TyDecl(ty,attr,sem) -> typeC old_metas table minus ty
+ | Ast0.TyDecl(ty,attr,sem) ->
+ typeC old_metas table minus ty;
+ List.iter (attribute old_metas table minus) attr
| Ast0.Typedef(stg,ty,id,sem) ->
typeC old_metas table minus ty;
typeC old_metas table minus id
@@ -377,9 +382,9 @@ and initialiser_list old_metas table minus =
and parameterTypeDef old_metas table minus param =
match Ast0.unwrap param with
Ast0.Param(ty,id,attr) ->
- (* No meta attribute yet *)
get_opt (ident ID old_metas table minus) id;
- typeC old_metas table minus ty
+ typeC old_metas table minus ty;
+ List.iter (attribute old_metas table minus) attr
| Ast0.MetaParam(name,_,_) ->
check_table table minus name
| Ast0.MetaParamList(name,len,_,_) ->
@@ -519,7 +524,13 @@ and fninfo old_metas table minus = function
Ast0.FStorage(stg) -> ()
| Ast0.FType(ty) -> typeC old_metas table minus ty
| Ast0.FInline(inline) -> ()
- | Ast0.FAttr(attr) -> ()
+ | Ast0.FAttr(attr) -> attribute old_metas table minus attr
+
+and attribute old_metas table minus x =
+ match Ast0.unwrap x with
+ Ast0.MetaAttribute(name,_,_) ->
+ check_table table minus name
+ | _ -> ()
and whencode notfn alwaysfn expression = function
Ast0.WhenNot (_,_,a) -> notfn a
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev 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 ` [Cocci] [PATCH 14/43] engine: pretty_print_engine: Add MetaAttributeVal Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 15/43] ocaml: coccilib: Reflect MetaAttributeVal 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 ` Jaskaran Singh [this message]
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-21-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).