cocci.inria.fr archive mirror
 help / color / mirror / Atom feed
* [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL
@ 2020-07-26 12:50 Jaskaran Singh
  2020-07-26 12:50 ` [Cocci] [PATCH 01/43] parsing_cocci: ast0_cocci: Add MetaAttribute & MetaAttributeDecl Jaskaran Singh
                   ` (43 more replies)
  0 siblings, 44 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:50 UTC (permalink / raw)
  To: cocci

This patch series aims to add support for meta attributes in SmPL.
Currently, only meta attributes in context and minus code are supported.

Changes include adding the MetaAttribute and MetaAttributeDecl constructors to
the SmPL ASTs and the MetaAttributeVal constructor to the C AST.

Two test cases are included for detecting and removing meta attributes.

Jaskaran Singh (43):
      parsing_cocci: ast0_cocci: Add MetaAttribute & MetaAttributeDecl
      parsing_cocci: parser: Parse meta attributes and metaattr decls
      parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl
      parsing_cocci: ast_cocci: Add MetaAttribute & MetaAttributeDecl
      parsing_cocci: iso_pattern: Reflect MetaAttribute & MetaAttributeDecl
      parsing_c: unparse_hrule: Reflect MetaAttribute & MetaAttributeDecl
      parsing_cocci: pretty_print_cocci: Reflect MetaAttribute & MetaAttributeDecl
      ocaml: coccilib: Reflect MetaAttribute & MetaAttributeDecl
      ocaml: yes_prepare_ocamlcocci: Reflect MetaAttribute & MetaAttributeDecl
      parsing_c: ast_c: Add MetaAttributeVal
      parsing_c: unparse_hrule: Reflect MetaAttributeVal
      engine: cocci_vs_c: Reflect MetaAttributeVal
      engine: pattern_c: Reflect MetaAttributeVal
      engine: pretty_print_engine: Add MetaAttributeVal
      ocaml: coccilib: Reflect MetaAttributeVal
      ocaml: ocamlcocci_aux: Reflect MetaAttributeVal
      ocaml: run_ocamlcocci: Reflect MetaAttributeVal
      python: pycocci_aux: Reflect MetaAttributeVal
      parsing_cocci: visitor_ast0: Reflect MetaAttribute
      parsing_cocci: check_meta: Reflect MetaAttribute
      parsing_cocci: adjust_pragmas: Reflect MetaAttribute
      parsing_cocci: context_neg: Reflect MetaAttribute
      parsing_cocci: compute_lines: Reflect MetaAttribute
      parsing_cocci: iso_pattern: Reflect MetaAttribute
      parsing_cocci: function_prototypes: Reflect MetaAttribute
      parsing_cocci: arity: Reflect MetaAttribute
      parsing_cocci: unitary_ast0: Reflect MetaAttribute
      parsing_cocci: unparse_ast0: Reflect MetaAttribute
      parsing_cocci: ast0toast: Reflect MetaAttribute
      parsing_cocci: visitor_ast: Reflect MetaAttribute
      parsing_cocci: cleanup_rules: Reflect MetaAttribute
      parsing_cocci: free_vars: Reflect MetaAttribute
      parsing_cocci: get_constants: Reflect MetaAttribute
      parsing_cocci: get_constants2: Reflect MetaAttribute
      parsing_cocci: index: Reflect MetaAttribute
      parsing_cocci: pretty_print_cocci: Reflect MetaAttribute
      parsing_cocci: safe_for_multi_decls: Reflect MetaAttribute
      parsing_cocci: unify_ast: Reflect MetaAttribute
      parsing_c: unparse_cocci: Reflect MetaAttribute
      engine: cocci_vs_c: Reflect MetaAttribute
      tools: spgen: Reflect MetaAttribute
      tests: Add test case to match meta attribute
      tests: Add test case to remove a meta attribute

 engine/cocci_vs_c.ml                  |   23 ++++++++++++++---
 engine/pattern_c.ml                   |    6 ++++
 engine/pretty_print_engine.ml         |    1 
 ocaml/coccilib.ml                     |    1 
 ocaml/coccilib.mli                    |    7 +++++
 ocaml/ocamlcocci_aux.ml               |    2 +
 ocaml/run_ocamlcocci.ml               |    1 
 ocaml/yes_prepare_ocamlcocci.ml       |    1 
 parsing_c/ast_c.ml                    |    1 
 parsing_c/ast_c.mli                   |    1 
 parsing_c/lib_parsing_c.ml            |    3 ++
 parsing_c/lib_parsing_c.mli           |    3 ++
 parsing_c/pretty_print_c.ml           |   12 ++++++++
 parsing_c/pretty_print_c.mli          |    5 +++
 parsing_c/unparse_cocci.ml            |    6 ++++
 parsing_c/unparse_hrule.ml            |    5 +++
 parsing_cocci/adjust_pragmas.ml       |    3 ++
 parsing_cocci/arity.ml                |   29 ++++++++++++++-------
 parsing_cocci/ast0_cocci.ml           |    1 
 parsing_cocci/ast0_cocci.mli          |    1 
 parsing_cocci/ast0toast.ml            |    4 ++
 parsing_cocci/ast_cocci.ml            |    3 ++
 parsing_cocci/ast_cocci.mli           |    2 +
 parsing_cocci/check_meta.ml           |   27 ++++++++++++++-----
 parsing_cocci/cleanup_rules.ml        |   10 ++++++-
 parsing_cocci/compute_lines.ml        |   14 ++++++----
 parsing_cocci/context_neg.ml          |   18 ++++++++-----
 parsing_cocci/data.ml                 |    1 
 parsing_cocci/data.mli                |    1 
 parsing_cocci/free_vars.ml            |   28 ++++++++++++++++++--
 parsing_cocci/function_prototypes.ml  |   10 ++++++-
 parsing_cocci/get_constants.ml        |    7 ++++-
 parsing_cocci/get_constants2.ml       |    9 +++---
 parsing_cocci/index.ml                |    3 +-
 parsing_cocci/iso_pattern.ml          |   46 +++++++++++++++++++++++++++++-----
 parsing_cocci/lexer_cocci.mll         |   12 ++++++++
 parsing_cocci/parse_aux.ml            |    4 ++
 parsing_cocci/parse_cocci.ml          |   11 ++++++--
 parsing_cocci/parser_cocci_menhir.mly |   25 ++++++++++++------
 parsing_cocci/pretty_print_cocci.ml   |    3 ++
 parsing_cocci/safe_for_multi_decls.ml |    1 
 parsing_cocci/unify_ast.ml            |    2 +
 parsing_cocci/unitary_ast0.ml         |    8 +++++
 parsing_cocci/unparse_ast0.ml         |    1 
 parsing_cocci/visitor_ast.ml          |    7 +++--
 parsing_cocci/visitor_ast0.ml         |    5 ++-
 python/pycocci_aux.ml                 |    2 +
 tests/metaattr.c                      |    5 +++
 tests/metaattr.cocci                  |    9 ++++++
 tests/metaattr.res                    |    5 +++
 tests/remove_metaattr.c               |    5 +++
 tests/remove_metaattr.cocci           |    9 ++++++
 tests/remove_metaattr.res             |    5 +++
 tools/spgen/source/meta_variable.ml   |    8 +++++
 54 files changed, 357 insertions(+), 65 deletions(-)


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

^ permalink raw reply	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 01/43] parsing_cocci: ast0_cocci: Add MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
@ 2020-07-26 12:50 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 02/43] parsing_cocci: parser: Parse meta attributes and metaattr decls Jaskaran Singh
                   ` (42 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:50 UTC (permalink / raw)
  To: cocci

Add the MetaAttribute and MetaAttributeDecl variants to AST0 of SmPL.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/ast0_cocci.ml  | 1 +
 parsing_cocci/ast0_cocci.mli | 1 +
 2 files changed, 2 insertions(+)

diff --git a/parsing_cocci/ast0_cocci.ml b/parsing_cocci/ast0_cocci.ml
index d7d810014..eac1d10c7 100644
--- a/parsing_cocci/ast0_cocci.ml
+++ b/parsing_cocci/ast0_cocci.ml
@@ -462,6 +462,7 @@ and fninfo =
 
 and base_attr =
     Attribute of string mcode
+  | MetaAttribute of Ast.meta_name mcode * constraints * pure
 
 and attr = base_attr wrap
 
diff --git a/parsing_cocci/ast0_cocci.mli b/parsing_cocci/ast0_cocci.mli
index 6097039fd..431a542f8 100644
--- a/parsing_cocci/ast0_cocci.mli
+++ b/parsing_cocci/ast0_cocci.mli
@@ -447,6 +447,7 @@ and fninfo =
 
 and base_attr =
     Attribute of string mcode
+  | MetaAttribute of Ast_cocci.meta_name mcode * constraints * pure
 
 and attr = base_attr wrap
 
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 02/43] parsing_cocci: parser: Parse meta attributes and metaattr decls
  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 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 03/43] parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl Jaskaran Singh
                   ` (41 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

Introduce changes to parse meta attributes and meta attribute
declarations in SmPL rules. Currently, meta attributes are only parsed
in context and minus code.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/data.ml                 |  1 +
 parsing_cocci/data.mli                |  1 +
 parsing_cocci/lexer_cocci.mll         | 12 ++++++++++++
 parsing_cocci/parse_aux.ml            |  4 ++++
 parsing_cocci/parser_cocci_menhir.mly | 25 +++++++++++++++++--------
 5 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/parsing_cocci/data.ml b/parsing_cocci/data.ml
index d604fd636..3c5e6c941 100644
--- a/parsing_cocci/data.ml
+++ b/parsing_cocci/data.ml
@@ -132,6 +132,7 @@ let add_binaryOp_meta:
 
 let add_type_name: (string -> unit) ref = ref uninitialized_add_meta
 let add_attribute: (string -> unit) ref = ref uninitialized_add_meta
+let add_attribute_meta: cstr_meta_type ref = ref uninitialized_add_meta
 let add_declarer_name: (string -> unit) ref = ref uninitialized_add_meta
 let add_iterator_name: (string -> unit) ref = ref uninitialized_add_meta
 
diff --git a/parsing_cocci/data.mli b/parsing_cocci/data.mli
index 9fa4e45a2..88f29baa7 100644
--- a/parsing_cocci/data.mli
+++ b/parsing_cocci/data.mli
@@ -112,6 +112,7 @@ val add_binaryOp_meta:
 
 val add_type_name: (string -> unit) ref
 val add_attribute: (string -> unit) ref
+val add_attribute_meta: cstr_meta_type ref
 val add_declarer_name: (string -> unit) ref
 val add_iterator_name: (string -> unit) ref
 val init_rule: (unit -> unit) ref
diff --git a/parsing_cocci/lexer_cocci.mll b/parsing_cocci/lexer_cocci.mll
index f05c6de02..9e85efe48 100644
--- a/parsing_cocci/lexer_cocci.mll
+++ b/parsing_cocci/lexer_cocci.mll
@@ -533,6 +533,18 @@ let init _ = (* per file, first .cocci then iso *)
 	    TDirective (Ast.Space name, clt)
 	| _ -> Tattr (name, clt) in
       Hashtbl.replace attr_names name fn);
+  Data.add_attribute_meta :=
+    (fun name cstr pure ->
+      let fn ((d,ln,_,_,_,_,_,_,_,_) as clt) =
+        if (match d with (Data.PLUS | Data.PLUSPLUS) -> true | _ -> false)
+        then
+          (* TODO support meta attributes in plus code *)
+	  failwith
+	    (Printf.sprintf
+             "%d: meta attributes currently only allowed in context/minus code"
+             ln);
+        TMetaAttribute(name,cstr,pure,clt) in
+      Hashtbl.replace metavariables (get_name name) fn);
   Data.add_declarer_name :=
     (function name ->
       let fn clt = TDeclarerId(name,clt) in
diff --git a/parsing_cocci/parse_aux.ml b/parsing_cocci/parse_aux.ml
index f2036bfc1..7ba7ce861 100644
--- a/parsing_cocci/parse_aux.ml
+++ b/parsing_cocci/parse_aux.ml
@@ -345,6 +345,10 @@ let check_meta_tyopt type_irrelevant v =
       (match meta_lookup rule name v with
 	Ast.MetaFragListDecl(_,_,_) -> ()
       | _ -> fail name)
+  | Ast.MetaAttributeDecl(Ast.NONE,(rule,name)) ->
+      (match meta_lookup rule name v with
+	Ast.MetaAttributeDecl(_,_) -> ()
+      | _ -> fail name)
   | Ast.MetaAnalysisDecl(analyzer,(rule,name)) ->
       (match meta_lookup rule name v with
 	Ast.MetaAnalysisDecl(analyzer1,_) ->
diff --git a/parsing_cocci/parser_cocci_menhir.mly b/parsing_cocci/parser_cocci_menhir.mly
index af9726e10..056ed0048 100644
--- a/parsing_cocci/parser_cocci_menhir.mly
+++ b/parsing_cocci/parser_cocci_menhir.mly
@@ -254,6 +254,7 @@ let inline_id aft = function
 %token <Parse_aux.expinfo>       TMetaErr
 %token <Parse_aux.cstrinfo>          TMetaParam TMetaStm
 %token <Parse_aux.cstrinfo>          TMetaInit TMetaDecl TMetaField TMeta
+%token <Parse_aux.cstrinfo>          TMetaAttribute
 %token <Parse_aux.list_info>     TMetaParamList TMetaExpList TMetaInitList
 %token <Parse_aux.list_info>     TMetaFieldList TMetaStmList TMetaDParamList
 %token <Parse_aux.typed_expinfo_bitfield> TMetaExp
@@ -764,6 +765,10 @@ delimited_list_len:
     { (fun arity name pure check_meta constraints ->
       let tok = check_meta(Ast_cocci.MetaTypeDecl(arity,name)) in
       !Data.add_type_meta name constraints pure; tok) }
+| TAttribute
+    { (fun arity name pure check_meta constraints ->
+      let tok = check_meta(Ast.MetaAttributeDecl(arity,name)) in
+      !Data.add_attribute_meta name constraints pure; tok) }
 | TError
     { (fun arity name pure check_meta constraints ->
       let tok = check_meta(Ast_cocci.MetaErrDecl(arity,name)) in
@@ -1495,11 +1500,11 @@ fninfo:
 	let _ = List.find (function Ast0_cocci.FInline(_) -> true | _ -> false) $2 in
 	raise (Semantic_cocci.Semantic "duplicate inline")
       with Not_found -> (Ast0_cocci.FInline(Parse_aux.clt2mcode "inline" $1))::$2 }
-  | a=Tattr    fninfo
+  | a=attr    fninfo
       { try
 	let _ = List.find (function Ast0_cocci.FAttr(_) -> true | _ -> false) $2 in
 	raise (Semantic_cocci.Semantic "multiple attributes")
-      with Not_found -> (Ast0_cocci.FAttr(Parse_aux.make_attr a))::$2 }
+      with Not_found -> (Ast0_cocci.FAttr(a))::$2 }
 
 fninfo_nt:
     /* empty */ { [] }
@@ -1514,11 +1519,11 @@ fninfo_nt:
 	let _ = List.find (function Ast0_cocci.FInline(_) -> true | _ -> false) $2 in
 	raise (Semantic_cocci.Semantic "duplicate inline")
       with Not_found -> (Ast0_cocci.FInline(Parse_aux.clt2mcode "inline" $1))::$2 }
-  | a=Tattr    fninfo_nt
+  | a=attr    fninfo_nt
       { try
 	let _ = List.find (function Ast0_cocci.FAttr(_) -> true | _ -> false) $2 in
 	raise (Semantic_cocci.Semantic "duplicate init")
-      with Not_found -> (Ast0_cocci.FAttr(Parse_aux.make_attr a))::$2 }
+      with Not_found -> (Ast0_cocci.FAttr(a))::$2 }
 
 storage:
          s=Tstatic      { Parse_aux.clt2mcode Ast_cocci.Static s }
@@ -3228,13 +3233,17 @@ script_virt_name_decl:
 %inline
 attr_list:
                            { [] }
- | Tattr f=full_attr_list
-    { let a = Parse_aux.make_attr $1 in a::f }
+ | a=attr f=full_attr_list  { a::f }
 
 full_attr_list:
                            { [] }
- | Tattr f=full_attr_list
-    { let a = Parse_aux.make_attr $1 in a::f }
+ | a=attr f=full_attr_list  { a::f }
+
+attr:
+   Tattr { Parse_aux.make_attr $1 }
+ | TMetaAttribute
+    { let (nm,cstr,pure,clt) = $1 in
+      Ast0_cocci.wrap(Ast0_cocci.MetaAttribute(Parse_aux.clt2mcode nm clt,cstr,pure)) }
 
 anything: /* used for script code */
    TIdentifier { "identifier" }
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 03/43] parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl
  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 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 04/43] parsing_cocci: ast_cocci: Add " Jaskaran Singh
                   ` (40 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect
these changes in parse_cocci.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/parse_cocci.ml | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/parsing_cocci/parse_cocci.ml b/parsing_cocci/parse_cocci.ml
index e455fce06..e8dca63a3 100644
--- a/parsing_cocci/parse_cocci.ml
+++ b/parsing_cocci/parse_cocci.ml
@@ -243,6 +243,7 @@ let token2c (tok,_) add_clt =
   | PC.TMetaDParamList(_,_,_,_,clt) -> add_clt "dparamlistmeta" clt
   | PC.TMetaFunc(_,_,_,clt)  -> add_clt "funcmeta" clt
   | PC.TMetaLocalFunc(_,_,_,clt) -> add_clt "funcmeta" clt
+  | PC.TMetaAttribute(_,_,_,clt) -> add_clt "attributemeta" clt
   | PC.TMetaPos(_,_,_,clt)   -> "posmeta"
   | PC.TMetaCom(_,_,clt)   -> "commeta"
   | PC.TMPtVirg -> ";"
@@ -404,6 +405,7 @@ let plus_attachable only_plus (tok,_) =
   | PC.TCPar0(s,clt) -> NOTPLUS
   | PC.TMetaPos(nm,_,_,_) -> NOTPLUS
   | PC.TMetaCom(nm,_,_) -> NOTPLUS
+  | PC.TMetaAttribute(nm,_,_,_) -> NOTPLUS
   | PC.TSub(clt) -> NOTPLUS
   | PC.TDirective(_,clt) -> NOTPLUS
   | PC.TAttr_(clt) -> NOTPLUS
@@ -466,6 +468,7 @@ let get_clt (tok,_) =
   | PC.TMetaFieldList(_,_,_,_,clt)
   | PC.TMetaFunc(_,_,_,clt) | PC.TMetaLocalFunc(_,_,_,clt)
   | PC.TMetaPos(_,_,_,clt) | PC.TMetaCom(_,_,clt)
+  | PC.TMetaAttribute(_,_,_,clt)
   | PC.TMetaDeclarer(_,_,_,clt) | PC.TMetaIterator(_,_,_,clt)
 
   | PC.TWhen(clt) | PC.TWhenTrue(clt) | PC.TWhenFalse(clt)
@@ -680,6 +683,7 @@ let update_clt (tok,x) clt =
   | PC.TMetaDParamList(a,b,c,d,_) -> (PC.TMetaDParamList(a,b,c,d,clt),x)
   | PC.TMetaFunc(a,b,c,_)  -> (PC.TMetaFunc(a,b,c,clt),x)
   | PC.TMetaLocalFunc(a,b,c,_) -> (PC.TMetaLocalFunc(a,b,c,clt),x)
+  | PC.TMetaAttribute(a,b,c,_) -> (PC.TMetaAttribute(a,b,c,clt),x)
 
   | PC.TMetaDeclarer(a,b,c,_) -> (PC.TMetaDeclarer(a,b,c,clt),x)
   | PC.TMetaIterator(a,b,c,_) -> (PC.TMetaIterator(a,b,c,clt),x)
@@ -929,7 +933,8 @@ let split_token ((tok,_) as t) =
   | PC.TMetaDeclarer(_,_,_,clt) | PC.TMetaIterator(_,_,_,clt) -> split t clt
   | PC.TMPtVirg | PC.TArob | PC.TArobArob | PC.TScript _
   | PC.TInitialize | PC.TFinalize -> ([t],[t])
-  | PC.TPArob clt | PC.TMetaPos(_,_,_,clt) | PC.TMetaCom(_,_,clt) -> split t clt
+  | PC.TPArob clt | PC.TMetaPos(_,_,_,clt) | PC.TMetaCom(_,_,clt)
+  | PC.TMetaAttribute (_,_,_,clt) -> split t clt
 
   | PC.TFunDecl(clt) | PC.TFunProto(clt)
   | PC.TWhen(clt) | PC.TWhenTrue(clt) | PC.TWhenFalse(clt)
@@ -1220,7 +1225,8 @@ let detect_types in_meta_decls l =
     | (PC.TMetaStmList(_,_,_,_,_),_)
     | (PC.TMetaDParamList(_,_,_,_,_),_)
     | (PC.TMetaPos(_,_,_,_),_)
-    | (PC.TMetaCom(_,_,_),_) -> in_meta_decls
+    | (PC.TMetaCom(_,_,_),_)
+    | (PC.TMetaAttribute(_,_,_,_),_) -> in_meta_decls
     | _ -> false in
   let is_tyleft = function (* things that can start a var decl *)
       (PC.TMul(_),_)
@@ -1330,6 +1336,7 @@ let token2line (tok,_) =
   | PC.TMetaStm(_,_,_,clt) | PC.TMetaStmList(_,_,_,_,clt)
   | PC.TMetaDParamList(_,_,_,_,clt) | PC.TMetaFunc(_,_,_,clt)
   | PC.TMetaLocalFunc(_,_,_,clt) | PC.TMetaPos(_,_,_,clt) | PC.TMetaCom(_,_,clt)
+  | PC.TMetaAttribute(_,_,_,clt)
 
   | PC.TFunDecl(clt) | PC.TFunProto(clt)
   | PC.TWhen(clt) | PC.TWhenTrue(clt) | PC.TWhenFalse(clt)
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 04/43] parsing_cocci: ast_cocci: Add MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (2 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 03/43] parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 05/43] parsing_cocci: iso_pattern: Reflect " Jaskaran Singh
                   ` (39 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

Add the MetaAttribute and MetaAttributeDecl consturctors the SmPL AST.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/ast_cocci.ml  | 3 +++
 parsing_cocci/ast_cocci.mli | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/parsing_cocci/ast_cocci.ml b/parsing_cocci/ast_cocci.ml
index 666629c58..656c3d929 100644
--- a/parsing_cocci/ast_cocci.ml
+++ b/parsing_cocci/ast_cocci.ml
@@ -128,6 +128,7 @@ and metavar =
   | MetaPosDecl of arity * meta_name (* name *)
   | MetaComDecl of arity * meta_name (* name *)
   | MetaFmtDecl of arity * meta_name (* name *)
+  | MetaAttributeDecl of arity * meta_name (* name *)
   | MetaFragListDecl of arity * meta_name (* name *) * list_len (*len*)
   | MetaAnalysisDecl of string * meta_name (* name *)
   | MetaDeclarerDecl of arity * meta_name (* name *)
@@ -626,6 +627,7 @@ and fninfo =
 
 and base_attr =
     Attribute of string mcode
+  | MetaAttribute of meta_name mcode * constraints * keep_binding * inherited
 
 and attr = base_attr wrap
 
@@ -914,6 +916,7 @@ let get_meta_name = function
   | MetaPosDecl(_ar,nm) -> nm
   | MetaComDecl(_ar,nm) -> nm
   | MetaFmtDecl(_ar,nm) -> nm
+  | MetaAttributeDecl(_ar,nm) -> nm
   | MetaFragListDecl(_ar,nm,_nm1) -> nm
   | MetaAnalysisDecl(_code,nm) -> nm
   | MetaDeclarerDecl(_ar,nm) -> nm
diff --git a/parsing_cocci/ast_cocci.mli b/parsing_cocci/ast_cocci.mli
index 983449123..9495e83c8 100644
--- a/parsing_cocci/ast_cocci.mli
+++ b/parsing_cocci/ast_cocci.mli
@@ -113,6 +113,7 @@ and metavar =
   | MetaPosDecl of arity * meta_name (* name *)
   | MetaComDecl of arity * meta_name (* name *)
   | MetaFmtDecl of arity * meta_name (* name *)
+  | MetaAttributeDecl of arity * meta_name (* name *)
   | MetaFragListDecl of arity * meta_name (* name *) * list_len (*len*)
   | MetaAnalysisDecl of string * meta_name (* name *)
   | MetaDeclarerDecl of arity * meta_name (* name *)
@@ -606,6 +607,7 @@ and fninfo =
 
 and base_attr =
     Attribute of string mcode
+  | MetaAttribute of meta_name mcode * constraints * keep_binding * inherited
 
 and attr = base_attr wrap
 
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 05/43] parsing_cocci: iso_pattern: Reflect MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (3 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 04/43] parsing_cocci: ast_cocci: Add " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 06/43] parsing_c: unparse_hrule: " Jaskaran Singh
                   ` (38 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect
these changes in iso_pattern.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/iso_pattern.ml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml
index 24c2927c9..4a9a80b4f 100644
--- a/parsing_cocci/iso_pattern.ml
+++ b/parsing_cocci/iso_pattern.ml
@@ -2458,6 +2458,8 @@ let get_name bindings = function
       (nm,function nm -> Ast.MetaFragListDecl(ar,nm,nm1))
   | Ast.MetaFmtDecl(ar,nm) ->
       (nm,function nm -> Ast.MetaFmtDecl(ar,nm))
+  | Ast.MetaAttributeDecl(ar,nm) ->
+      (nm,function nm -> Ast.MetaAttributeDecl(ar,nm))
   | Ast.MetaAnalysisDecl(ar,nm) ->
       (nm,function nm -> Ast.MetaAnalysisDecl(ar,nm))
   | Ast.MetaDeclarerDecl(ar,nm) ->
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 06/43] parsing_c: unparse_hrule: Reflect MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (4 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 05/43] parsing_cocci: iso_pattern: Reflect " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 07/43] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
                   ` (37 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect
these changes in unparse_hrule.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_c/unparse_hrule.ml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/parsing_c/unparse_hrule.ml b/parsing_c/unparse_hrule.ml
index 3078dde41..4d7ba93cc 100644
--- a/parsing_c/unparse_hrule.ml
+++ b/parsing_c/unparse_hrule.ml
@@ -432,6 +432,8 @@ let pp_meta_decl pr env decl =
       no_arity ar; pr "comments "; pp_name name; pr ";\n"
   | Ast.MetaFmtDecl(ar, name) ->
       no_arity ar; pr "format "; pp_name name; pr ";\n"
+  | Ast.MetaAttributeDecl(ar, name) ->
+      no_arity ar; pr "attribute "; pp_name name; pr ";\n"
   | Ast.MetaFragListDecl(ar, name, len) ->
       no_arity ar; pr "format list "; pp_len pr len; pp_name name; pr ";\n"
   | Ast.MetaAnalysisDecl(code, name) ->
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 07/43] parsing_cocci: pretty_print_cocci: Reflect MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (5 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 06/43] parsing_c: unparse_hrule: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 08/43] ocaml: coccilib: " Jaskaran Singh
                   ` (36 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect
these changes in pretty_print_cocci.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/pretty_print_cocci.ml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/parsing_cocci/pretty_print_cocci.ml b/parsing_cocci/pretty_print_cocci.ml
index 095144b17..fe54a8d61 100644
--- a/parsing_cocci/pretty_print_cocci.ml
+++ b/parsing_cocci/pretty_print_cocci.ml
@@ -1110,6 +1110,8 @@ let unparse_cocci_mv rule = function
       print_string "comments "; print_name rule r n; print_string ";"
   | Ast.MetaFmtDecl(_,(r,n)) ->
       print_string "format "; print_name rule r n; print_string ";"
+  | Ast.MetaAttributeDecl(_,(r,n)) ->
+      print_string "attribute "; print_name rule r n; print_string ";"
   | Ast.MetaFragListDecl(_,(r,n),len) ->
       print_string "fragment list"; print_listlen rule len;
       print_name rule r n; print_string ";"
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 08/43] ocaml: coccilib: Reflect MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (6 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 07/43] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 09/43] ocaml: yes_prepare_ocamlcocci: " Jaskaran Singh
                   ` (35 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect
these changes in coccilib.mli.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 ocaml/coccilib.mli | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli
index 19f1512cd..3960d1046 100644
--- a/ocaml/coccilib.mli
+++ b/ocaml/coccilib.mli
@@ -2520,6 +2520,7 @@ module Ast_cocci :
       | MetaPosDecl of arity * meta_name
       | MetaComDecl of arity * meta_name
       | MetaFmtDecl of arity * meta_name
+      | MetaAttributeDecl of arity * meta_name
       | MetaFragListDecl of arity * meta_name * list_len
       | MetaAnalysisDecl of string * meta_name
       | MetaDeclarerDecl of arity * meta_name
@@ -2928,6 +2929,8 @@ module Ast_cocci :
     and base_attr =
       Ast_cocci.base_attr =
         Attribute of string mcode
+      | MetaAttribute of meta_name mcode * constraints * keep_binding *
+          inherited
     and attr = base_attr wrap
     and metaStmtInfo =
       Ast_cocci.metaStmtInfo =
@@ -3560,6 +3563,7 @@ module Ast0_cocci :
     and base_attr =
       Ast0_cocci.base_attr =
         Attribute of string mcode
+      | MetaAttribute of Ast_cocci.meta_name mcode * constraints * pure
     and attr = base_attr wrap
     and ('a, 'b) whencode =
       ('a, 'b) Ast0_cocci.whencode =
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 09/43] ocaml: yes_prepare_ocamlcocci: Reflect MetaAttribute & MetaAttributeDecl
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (7 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 08/43] ocaml: coccilib: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 10/43] parsing_c: ast_c: Add MetaAttributeVal Jaskaran Singh
                   ` (34 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute and MetaAttributeDecl are added to the SmPL AST. Reflect
these changes in yes_prepare_ocamlcocci.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 ocaml/yes_prepare_ocamlcocci.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ocaml/yes_prepare_ocamlcocci.ml b/ocaml/yes_prepare_ocamlcocci.ml
index aa6a1b606..fef237189 100644
--- a/ocaml/yes_prepare_ocamlcocci.ml
+++ b/ocaml/yes_prepare_ocamlcocci.ml
@@ -114,6 +114,7 @@ let ast_rep_binding ctr = function
   | (Some nm,Ast.MetaStmDecl _) -> print_match ctr nm "Stmt"
   | (Some nm,Ast.MetaStmListDecl _) -> print_match ctr nm "StmtList"
   | (Some nm,Ast.MetaFmtDecl _) -> print_match ctr nm "Fmt"
+  | (Some nm,Ast.MetaAttributeDecl _) -> print_match ctr nm "Attribute"
   | (Some nm,Ast.MetaFragListDecl _) -> print_match ctr nm "FragList"
   | (Some nm,Ast.MetaFuncDecl _) -> print_match ctr nm "Str"
   | (Some nm,Ast.MetaLocalFuncDecl _) -> print_match ctr nm "Str"
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 10/43] parsing_c: ast_c: Add MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (8 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 09/43] ocaml: yes_prepare_ocamlcocci: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 11/43] parsing_c: unparse_hrule: Reflect MetaAttributeVal Jaskaran Singh
                   ` (33 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

Add the MetaAttributeVal constructor to the C AST.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_c/ast_c.ml  | 1 +
 parsing_c/ast_c.mli | 1 +
 2 files changed, 2 insertions(+)

diff --git a/parsing_c/ast_c.ml b/parsing_c/ast_c.ml
index 645f9e183..2c682fe21 100644
--- a/parsing_c/ast_c.ml
+++ b/parsing_c/ast_c.ml
@@ -821,6 +821,7 @@ and metavars_binding = (Ast_cocci.meta_name, metavar_binding_kind) assoc
   | MetaStmtListVal  of statement_sequencable list * stripped
   | MetaDParamListVal of (string wrap) wrap2 list
   | MetaFmtVal       of string_format
+  | MetaAttributeVal of attribute
   | MetaFragListVal  of string_fragment list
   | MetaAssignOpVal  of assignOp
   | MetaBinaryOpVal  of binaryOp
diff --git a/parsing_c/ast_c.mli b/parsing_c/ast_c.mli
index a4d1f40d8..d03b5cf2b 100644
--- a/parsing_c/ast_c.mli
+++ b/parsing_c/ast_c.mli
@@ -326,6 +326,7 @@ and metavar_binding_kind =
   | MetaStmtListVal of statement_sequencable list * stripped
   | MetaDParamListVal of string wrap wrap2 list
   | MetaFmtVal of string_format
+  | MetaAttributeVal of attribute
   | MetaFragListVal of string_fragment list
   | MetaAssignOpVal of assignOp
   | MetaBinaryOpVal of binaryOp
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 11/43] parsing_c: unparse_hrule: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (9 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 10/43] parsing_c: ast_c: Add MetaAttributeVal Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 12/43] engine: cocci_vs_c: " Jaskaran Singh
                   ` (32 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_c/unparse_hrule.ml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/parsing_c/unparse_hrule.ml b/parsing_c/unparse_hrule.ml
index 4d7ba93cc..9d6421f31 100644
--- a/parsing_c/unparse_hrule.ml
+++ b/parsing_c/unparse_hrule.ml
@@ -251,6 +251,7 @@ let print_extra_typedefs pr env =
       | Ast_c.MetaFieldListVal(fields) ->
 	  Visitor_c.vk_struct_fields bigf fields
       | Ast_c.MetaFmtVal(fmt) -> Visitor_c.vk_string_format bigf fmt
+      | Ast_c.MetaAttributeVal(attr) -> Visitor_c.vk_attribute bigf attr
       | Ast_c.MetaFragListVal(frags) ->
 	  Visitor_c.vk_string_fragments bigf frags
       | Ast_c.MetaStmtVal(stm,_,_) -> Visitor_c.vk_statement bigf stm
@@ -313,6 +314,8 @@ let rename argids env =
 	   Ast_c.MetaFieldListVal(Visitor_c.vk_struct_fields_s bigf stm)
        | Ast_c.MetaFmtVal(fmt) ->
 	   Ast_c.MetaFmtVal(Visitor_c.vk_string_format_s bigf fmt)
+       | Ast_c.MetaAttributeVal(attr) ->
+	   Ast_c.MetaAttributeVal(Visitor_c.vk_attribute_s bigf attr)
        | Ast_c.MetaFragListVal(frags) ->
 	   Ast_c.MetaFragListVal(Visitor_c.vk_string_fragments_s bigf frags)
        | Ast_c.MetaStmtVal(stm,original,ty) ->
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 12/43] engine: cocci_vs_c: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (10 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 11/43] parsing_c: unparse_hrule: Reflect MetaAttributeVal Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 13/43] engine: pattern_c: " Jaskaran Singh
                   ` (31 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 engine/cocci_vs_c.ml        | 8 ++++++--
 parsing_c/lib_parsing_c.ml  | 3 +++
 parsing_c/lib_parsing_c.mli | 3 +++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml
index cba6c8d01..ed91a4785 100644
--- a/engine/cocci_vs_c.ml
+++ b/engine/cocci_vs_c.ml
@@ -229,6 +229,8 @@ let equal_metavarval valu valu' =
 
   | Ast_c.MetaFmtVal a, Ast_c.MetaFmtVal b ->
       Lib_parsing_c.al_string_format a = Lib_parsing_c.al_string_format b
+  | Ast_c.MetaAttributeVal a, Ast_c.MetaAttributeVal b ->
+      Lib_parsing_c.al_attribute a = Lib_parsing_c.al_attribute b
   | Ast_c.MetaFragListVal a, Ast_c.MetaFragListVal b ->
       Lib_parsing_c.al_string_fragments a =
       Lib_parsing_c.al_string_fragments b
@@ -287,7 +289,7 @@ let equal_metavarval valu valu' =
       |B.MetaExprListVal _
       |B.MetaExprVal _|B.MetaLocalFuncVal _|B.MetaFuncVal _|B.MetaIdVal _
       |B.MetaAssignOpVal _ | B.MetaBinaryOpVal _
-      |B.MetaFmtVal _|B.MetaFragListVal _
+      |B.MetaFmtVal _|B.MetaFragListVal _|B.MetaAttributeVal _
     ), _
       -> raise (Impossible 16)
 
@@ -322,6 +324,8 @@ let equal_inh_metavarval valu valu'=
   | Ast_c.MetaFmtVal a, Ast_c.MetaFmtVal b ->
       Lib_parsing_c.al_inh_string_format a =
       Lib_parsing_c.al_inh_string_format b
+  | Ast_c.MetaAttributeVal a, Ast_c.MetaAttributeVal b ->
+      Lib_parsing_c.al_inh_attribute a = Lib_parsing_c.al_inh_attribute b
   | Ast_c.MetaFragListVal a, Ast_c.MetaFragListVal b ->
       Lib_parsing_c.al_inh_string_fragments a =
       Lib_parsing_c.al_inh_string_fragments b
@@ -388,7 +392,7 @@ let equal_inh_metavarval valu valu'=
       |B.MetaExprListVal _
       |B.MetaExprVal _|B.MetaLocalFuncVal _|B.MetaFuncVal _|B.MetaIdVal _
       |B.MetaAssignOpVal _ | B.MetaBinaryOpVal _
-      |B.MetaFmtVal _|B.MetaFragListVal _
+      |B.MetaFmtVal _|B.MetaFragListVal _|B.MetaAttributeVal _
     ), _
       -> raise (Impossible 17)
 
diff --git a/parsing_c/lib_parsing_c.ml b/parsing_c/lib_parsing_c.ml
index 99e43be3b..687833604 100644
--- a/parsing_c/lib_parsing_c.ml
+++ b/parsing_c/lib_parsing_c.ml
@@ -86,6 +86,7 @@ let al_name      x = Visitor_c.vk_name_s      (strip_info_visitor()) x
 let al_string_format x = Visitor_c.vk_string_format_s (strip_info_visitor()) x
 let al_string_fragments x =
   Visitor_c.vk_string_fragments_s (strip_info_visitor()) x
+let al_attribute x = Visitor_c.vk_attribute_s (strip_info_visitor()) x
 
 let al_node      x = Visitor_c.vk_node_s      (strip_info_visitor()) x
 
@@ -147,6 +148,7 @@ let al_inh_string_format x =
   Visitor_c.vk_string_format_s (strip_inh_info_visitor()) x
 let al_inh_string_fragments x =
   Visitor_c.vk_string_fragments_s (strip_inh_info_visitor()) x
+let al_inh_attribute x = Visitor_c.vk_attribute_s (strip_inh_info_visitor()) x
 
 
 
@@ -184,6 +186,7 @@ let semi_al_string_format =
   Visitor_c.vk_string_format_s semi_strip_info_visitor
 let semi_al_string_fragments =
   Visitor_c.vk_string_fragments_s semi_strip_info_visitor
+let semi_al_attribute = Visitor_c.vk_attribute_s semi_strip_info_visitor
 
 let semi_al_program =
   List.map (Visitor_c.vk_toplevel_s semi_strip_info_visitor)
diff --git a/parsing_c/lib_parsing_c.mli b/parsing_c/lib_parsing_c.mli
index d9578f3ca..0e53f9060 100644
--- a/parsing_c/lib_parsing_c.mli
+++ b/parsing_c/lib_parsing_c.mli
@@ -22,6 +22,7 @@ val al_arguments :
 val al_fields : Ast_c.field list -> Ast_c.field list
 val al_name : Ast_c.name -> Ast_c.name
 val al_string_format : Ast_c.string_format -> Ast_c.string_format
+val al_attribute : Ast_c.attribute -> Ast_c.attribute
 val al_string_fragments :
   Ast_c.string_fragment list -> Ast_c.string_fragment list
 val al_node : Control_flow_c.node -> Control_flow_c.node
@@ -44,6 +45,7 @@ val al_inh_arguments :
 val al_inh_string_format : Ast_c.string_format -> Ast_c.string_format
 val al_inh_string_fragments :
   Ast_c.string_fragment list -> Ast_c.string_fragment list
+val al_inh_attribute : Ast_c.attribute -> Ast_c.attribute
 val semi_strip_info_visitor : Visitor_c.visitor_c_s
 val semi_al_expr : Ast_c.expression -> Ast_c.expression
 val semi_al_declaration : Ast_c.declaration -> Ast_c.declaration
@@ -67,6 +69,7 @@ val semi_al_arguments :
 val semi_al_string_format : Ast_c.string_format -> Ast_c.string_format
 val semi_al_string_fragments :
   Ast_c.string_fragment list -> Ast_c.string_fragment list
+val semi_al_attribute : Ast_c.attribute -> Ast_c.attribute
 val semi_al_program : Ast_c.toplevel list -> Ast_c.toplevel list
 val real_strip_info_visitor : 'a -> Visitor_c.visitor_c_s
 val real_al_expr : Ast_c.expression -> Ast_c.expression
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 13/43] engine: pattern_c: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (11 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 12/43] engine: cocci_vs_c: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 14/43] engine: pretty_print_engine: Add MetaAttributeVal Jaskaran Singh
                   ` (30 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 engine/pattern_c.ml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/engine/pattern_c.ml b/engine/pattern_c.ml
index 821a5900e..7d9a2dcc1 100644
--- a/engine/pattern_c.ml
+++ b/engine/pattern_c.ml
@@ -538,6 +538,12 @@ module XMATCH = struct
 		   (if strip
 		   then Lib_parsing_c.al_string_format a
 		   else Lib_parsing_c.semi_al_string_format a))
+          | Ast_c.MetaAttributeVal a ->
+	      success
+		(Ast_c.MetaAttributeVal
+		   (if strip
+		   then Lib_parsing_c.al_attribute a
+		   else Lib_parsing_c.semi_al_attribute a))
 
           | Ast_c.MetaPosVal (pos1,pos2) ->
 	      success(Ast_c.MetaPosVal (pos1,pos2))
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 14/43] engine: pretty_print_engine: Add MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (12 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 13/43] engine: pattern_c: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 15/43] ocaml: coccilib: Reflect MetaAttributeVal Jaskaran Singh
                   ` (29 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 15/43] ocaml: coccilib: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (13 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 14/43] engine: pretty_print_engine: Add MetaAttributeVal Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 16/43] ocaml: ocamlcocci_aux: " Jaskaran Singh
                   ` (28 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttributeVal is added to the C AST. Reflect these changes in
coccilib.ml and coccilib.mli.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 ocaml/coccilib.ml  | 1 +
 ocaml/coccilib.mli | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/ocaml/coccilib.ml b/ocaml/coccilib.ml
index 0a7e0eb98..459f4c6be 100644
--- a/ocaml/coccilib.ml
+++ b/ocaml/coccilib.ml
@@ -70,6 +70,7 @@ type param_type =
   | FieldList of Ast_c.field list
   | FragList of Ast_c.string_fragment list
   | Fmt of Ast_c.string_format
+  | Attribute of Ast_c.attribute
   | Stmt of Ast_c.statement
   | StmtList of Ast_c.statement_sequencable list
 
diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli
index 3960d1046..970229ee9 100644
--- a/ocaml/coccilib.mli
+++ b/ocaml/coccilib.mli
@@ -434,6 +434,7 @@ module Ast_c :
       | MetaStmtListVal of statement_sequencable list * stripped
       | MetaDParamListVal of string wrap wrap2 list
       | MetaFmtVal of string_format
+      | MetaAttributeVal of attribute
       | MetaFragListVal of string_fragment list
       | MetaAssignOpVal of assignOp
       | MetaBinaryOpVal of binaryOp
@@ -854,6 +855,7 @@ module Pretty_print_c :
       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;
     }
@@ -3785,6 +3787,7 @@ type param_type =
   | FieldList of Ast_c.field list
   | FragList of Ast_c.string_fragment list
   | Fmt of Ast_c.string_format
+  | Attribute of Ast_c.attribute
   | Stmt of Ast_c.statement
   | StmtList of Ast_c.statement_sequencable list
 val fcts :
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 16/43] ocaml: ocamlcocci_aux: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (14 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 15/43] ocaml: coccilib: Reflect MetaAttributeVal Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 17/43] ocaml: run_ocamlcocci: " Jaskaran Singh
                   ` (27 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 ocaml/ocamlcocci_aux.ml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ocaml/ocamlcocci_aux.ml b/ocaml/ocamlcocci_aux.ml
index 7ec3a964f..ccbf6858e 100644
--- a/ocaml/ocamlcocci_aux.ml
+++ b/ocaml/ocamlcocci_aux.ml
@@ -47,6 +47,8 @@ let stringrep = function
     call_pretty0 Pretty_print_c.pp_string_fragment_list_gen frags
 | Ast_c.MetaFmtVal fmt ->
     call_pretty0 Pretty_print_c.pp_string_format_gen fmt
+| Ast_c.MetaAttributeVal attr ->
+    call_pretty0 Pretty_print_c.pp_attribute_gen attr
 | Ast_c.MetaListlenVal n -> string_of_int n
 | Ast_c.MetaPosVal (pos1, pos2) ->
     let print_pos = function
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 17/43] ocaml: run_ocamlcocci: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (15 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 16/43] ocaml: ocamlcocci_aux: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 18/43] python: pycocci_aux: " Jaskaran Singh
                   ` (26 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 ocaml/run_ocamlcocci.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ocaml/run_ocamlcocci.ml b/ocaml/run_ocamlcocci.ml
index 065428391..14decf886 100644
--- a/ocaml/run_ocamlcocci.ml
+++ b/ocaml/run_ocamlcocci.ml
@@ -76,6 +76,7 @@ let ast_binding vl = function
       | Ast_c.MetaStmtListVal(stm,_) -> Coccilib.StmtList stm
       | Ast_c.MetaFragListVal frags -> Coccilib.FragList frags
       | Ast_c.MetaFmtVal fmt -> Coccilib.Fmt fmt
+      | Ast_c.MetaAttributeVal attr -> Coccilib.Attribute attr
       | Ast_c.MetaNoVal -> failwith "no value for script metavariable"
       | Ast_c.MetaComValList l -> Coccilib.AstCom l
 
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 18/43] python: pycocci_aux: Reflect MetaAttributeVal
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (16 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 17/43] ocaml: run_ocamlcocci: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 19/43] parsing_cocci: visitor_ast0: Reflect MetaAttribute Jaskaran Singh
                   ` (25 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 python/pycocci_aux.ml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/python/pycocci_aux.ml b/python/pycocci_aux.ml
index d83059455..85a8eefe3 100644
--- a/python/pycocci_aux.ml
+++ b/python/pycocci_aux.ml
@@ -81,6 +81,8 @@ let stringrep = function
     call_pretty0 Pretty_print_c.pp_string_fragment_list_gen frags
 | Ast_c.MetaFmtVal fmt ->
     call_pretty0 Pretty_print_c.pp_string_format_gen fmt
+| Ast_c.MetaAttributeVal attr ->
+    call_pretty0 Pretty_print_c.pp_attribute_gen attr
 | Ast_c.MetaListlenVal n -> string_of_int n
 | Ast_c.MetaPosVal (pos1, pos2) ->
     let print_pos = function
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 19/43] parsing_cocci: visitor_ast0: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (17 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 18/43] python: pycocci_aux: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 20/43] parsing_cocci: check_meta: " Jaskaran Singh
                   ` (24 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Visit meta attributes in the
SmPL AST0 visitor.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/visitor_ast0.ml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml
index e45f92415..0a5db947b 100644
--- a/parsing_cocci/visitor_ast0.ml
+++ b/parsing_cocci/visitor_ast0.ml
@@ -1154,7 +1154,10 @@ let visitor mode bind option_default
         (match Ast0.unwrap a with
           Ast0.Attribute(attr) ->
             let (attr_n,attr) = string_mcode attr in
-            (attr_n,Ast0.Attribute(attr))) in
+            (attr_n,Ast0.Attribute(attr))
+	| Ast0.MetaAttribute(name,constraints,pure) ->
+	    let (n,name) = meta_mcode name in
+	    (n,Ast0.MetaAttribute(name,constraints,pure))) in
     attributefn all_functions k a
 
   (* we only include the when string mcode w because the parameterised
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 20/43] parsing_cocci: check_meta: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (18 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 19/43] parsing_cocci: visitor_ast0: Reflect MetaAttribute Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 21/43] parsing_cocci: adjust_pragmas: " Jaskaran Singh
                   ` (23 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 21/43] parsing_cocci: adjust_pragmas: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (19 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 20/43] parsing_cocci: check_meta: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 22/43] parsing_cocci: context_neg: " Jaskaran Singh
                   ` (22 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
adjust_pragmas.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/adjust_pragmas.ml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/parsing_cocci/adjust_pragmas.ml b/parsing_cocci/adjust_pragmas.ml
index 8f24fa718..6891d886f 100644
--- a/parsing_cocci/adjust_pragmas.ml
+++ b/parsing_cocci/adjust_pragmas.ml
@@ -225,6 +225,9 @@ let left_attribute attr =
   match Ast0.unwrap attr with
     Ast0.Attribute(a) ->
       call_right left_mcode a attr (function a -> Ast0.Attribute(a))
+  | Ast0.MetaAttribute(name,a,b) ->
+      call_right left_mcode name attr
+        (function name -> Ast0.MetaAttribute(name,a,b))
 
 let left_fundecl name fninfo =
   let fncall_right processor data cont =
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 22/43] parsing_cocci: context_neg: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (20 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 21/43] parsing_cocci: adjust_pragmas: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 23/43] parsing_cocci: compute_lines: " Jaskaran Singh
                   ` (21 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
context_neg.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/context_neg.ml | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/parsing_cocci/context_neg.ml b/parsing_cocci/context_neg.ml
index ebb93806b..8b2512c9b 100644
--- a/parsing_cocci/context_neg.ml
+++ b/parsing_cocci/context_neg.ml
@@ -403,9 +403,6 @@ let classify is_minus all_marked table code =
 	  disj_cases e starter expr_list r.VT0.combiner_rec_expression ender
       |	_ -> k e) in
 
-  let attribute a =
-    match Ast0.unwrap a with
-      Ast0.Attribute(attr) -> mcode attr in
 
   (* not clear why we have the next cases, since DisjDecl and
   as it only comes from isos *)
@@ -430,7 +427,8 @@ let classify is_minus all_marked table code =
 	    (bind (r.VT0.combiner_rec_typeC ty)
 	       (bind (r.VT0.combiner_rec_ident id)
                   (bind
-                     (List.fold_right bind (List.map attribute attr)
+                     (List.fold_right bind
+                       (List.map r.VT0.combiner_rec_attribute attr)
 			option_default)
 		     (bind (mcode eq)
 			(bind (r.VT0.combiner_rec_initialiser ini)
@@ -440,7 +438,8 @@ let classify is_minus all_marked table code =
 	    (bind (r.VT0.combiner_rec_typeC ty)
 	       (bind (r.VT0.combiner_rec_ident id)
                   (bind
-                     (List.fold_right bind (List.map attribute attr)
+                     (List.fold_right bind
+                       (List.map r.VT0.combiner_rec_attribute attr)
 			option_default)
 		     (mcode sem))))
       |	_ -> k e) in
@@ -477,7 +476,9 @@ let classify is_minus all_marked table code =
 	  (* needed for the same reason as in the Init and UnInit cases *)
 	  bind (r.VT0.combiner_rec_typeC ty)
            (bind (r.VT0.combiner_rec_ident id)
-              (List.fold_right bind (List.map attribute attr) option_default))
+              (List.fold_right bind
+                 (List.map r.VT0.combiner_rec_attribute attr)
+                 option_default))
       |	_ -> k e) in
 
   let typeC r k e =
@@ -596,6 +597,9 @@ let equal_attribute a1 a2 =
   match (Ast0.unwrap a1, Ast0.unwrap a2) with
     (Ast0.Attribute(attr1),Ast0.Attribute(attr2)) ->
       equal_mcode attr1 attr2
+  | (Ast0.MetaAttribute(name1,_,_),Ast0.MetaAttribute(name2,_,_)) ->
+      equal_mcode name1 name2
+  | _ -> false
 
 let equal_ident i1 i2 =
   match (Ast0.unwrap i1,Ast0.unwrap i2) with
@@ -865,8 +869,10 @@ let equal_initialiser i1 i2 =
 let equal_parameterTypeDef p1 p2 =
   match (Ast0.unwrap p1,Ast0.unwrap p2) with
     (Ast0.VoidParam(_,ar1),Ast0.VoidParam(_,ar2)) ->
+      (List.length ar1) = (List.length ar2) &&
       List.for_all2 equal_attribute ar1 ar2
   | (Ast0.Param(_,_,ar1),Ast0.Param(_,_,ar2)) ->
+      (List.length ar1) = (List.length ar2) &&
       List.for_all2 equal_attribute ar1 ar2
   | (Ast0.MetaParam(name1,_,_),Ast0.MetaParam(name2,_,_))
   | (Ast0.MetaParamList(name1,_,_,_),Ast0.MetaParamList(name2,_,_,_)) ->
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 23/43] parsing_cocci: compute_lines: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (21 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 22/43] parsing_cocci: context_neg: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 24/43] parsing_cocci: iso_pattern: " Jaskaran Singh
                   ` (20 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
compute_lines.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/compute_lines.ml | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/parsing_cocci/compute_lines.ml b/parsing_cocci/compute_lines.ml
index 4420e9524..4042b1025 100644
--- a/parsing_cocci/compute_lines.ml
+++ b/parsing_cocci/compute_lines.ml
@@ -907,11 +907,15 @@ and initialiser_list prev = dots is_init_dots prev initialiser
 (* for export *)
 and initialiser_dots x = dots is_init_dots None initialiser x
 
-and attribute a =
-  match Ast0.unwrap a with
-    Ast0.Attribute(attr) ->
-      let ln = promote_mcode attr in
-      mkres a (Ast0.Attribute(attr)) ln ln
+and attribute attr =
+  match Ast0.unwrap attr with
+    Ast0.Attribute(a) ->
+      let ln = promote_mcode a in
+      mkres attr (Ast0.Attribute(a)) ln ln
+  | Ast0.MetaAttribute(name,a,b) ->
+      let name = normal_mcode name in
+      let ln = promote_mcode name in
+      mkres attr (Ast0.MetaAttribute(name,a,b)) ln ln
 
 
 (* --------------------------------------------------------------------- *)
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 24/43] parsing_cocci: iso_pattern: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (22 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 23/43] parsing_cocci: compute_lines: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 25/43] parsing_cocci: function_prototypes: " Jaskaran Singh
                   ` (19 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
iso_pattern.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/iso_pattern.ml | 44 +++++++++++++++++++++++++++++++-----
 1 file changed, 38 insertions(+), 6 deletions(-)

diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml
index 4a9a80b4f..c800665fd 100644
--- a/parsing_cocci/iso_pattern.ml
+++ b/parsing_cocci/iso_pattern.ml
@@ -475,13 +475,19 @@ let match_maker checks_needed context_required whencode_allowed =
 	  Ast0.MetaStmt(name,_,pure) | Ast0.MetaStmtList(name,_,_,pure) -> pure
 	| _ -> Ast0.Impure) in
 
+    let attribute r k a =
+      bind (bind (pure_mcodekind (Ast0.get_mcodekind a)) (k a))
+	(match Ast0.unwrap a with
+	  Ast0.MetaAttribute(name,_,pure) -> pure
+	| _ -> Ast0.Impure) in
+
     V0.flat_combiner bind option_default
       mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
       mcode mcode
       donothing donothing donothing donothing donothing donothing donothing
       donothing donothing
       ident expression assignOp binaryOp typeC init param decl field donothing
-      stmt donothing donothing donothing donothing donothing in
+      stmt donothing donothing donothing attribute donothing in
 
   let add_pure_list_binding name pure is_pure builder1 builder2 lst =
     match (checks_needed,pure) with
@@ -1417,10 +1423,22 @@ let match_maker checks_needed context_required whencode_allowed =
       |	_ -> return false in
     loop (patterninfo,cinfo)
 
-  and match_attribute a1 a2 =
-    match (Ast0.unwrap a1,Ast0.unwrap a2) with
-      (Ast0.Attribute(attr1),Ast0.Attribute(attr2)) ->
-        check_mcode attr1 attr2
+  and match_attribute pattern a =
+    match Ast0.unwrap pattern with
+      Ast0.MetaAttribute(name,_,pure) ->
+	add_pure_binding name pure pure_sp_code.VT0.combiner_rec_attribute
+	  (function a -> Ast0.AttributeTag a)
+	  a
+    | up ->
+	if not(checks_needed) || not(context_required) || is_context a
+	then
+	  match (up,Ast0.unwrap a) with
+	    (Ast0.Attribute(attra),Ast0.Attribute(attrb)) ->
+              if mcode_equal attra attrb
+              then check_mcode attra attrb
+              else return false
+	  | _ -> return false
+	else return_false (ContextRequired (Ast0.AttributeTag a))
 
   and match_attributes a1 a2 =
     match_list match_attribute
@@ -2169,13 +2187,27 @@ let instantiate bindings mv_bindings model =
 		(List.filter (function (x,v) -> x = (dot_term d)) bindings)))
     | _ -> e in
 
+  let attributefn r k e =
+    let e = k e in
+    match Ast0.unwrap e with
+      Ast0.MetaAttribute(name,cstr,pure) ->
+	(rebuild_mcode None).VT0.rebuilder_rec_attribute
+	  (match lookup name bindings mv_bindings with
+	    Common.Left(Ast0.AttributeTag(a)) -> a
+	  | Common.Left(_) -> failwith "not possible 1"
+	  | Common.Right(new_mv) ->
+	      Ast0.rewrap e
+		(Ast0.MetaAttribute
+                  (Ast0.set_mcode_data new_mv name,cstr,pure)))
+    | _ -> e in
+
   V0.flat_rebuilder
     mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
     mcode mcode
     (dots elist) donothing (dots plist) (dots slist) donothing donothing
     donothing donothing donothing
     identfn exprfn donothing donothing tyfn initfn paramfn declfn fieldfn
-    enumdeclfn stmtfn donothing donothing donothing donothing donothing
+    enumdeclfn stmtfn donothing donothing donothing attributefn donothing
 
 (* --------------------------------------------------------------------- *)
 
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 25/43] parsing_cocci: function_prototypes: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (23 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 24/43] parsing_cocci: iso_pattern: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 26/43] parsing_cocci: arity: " Jaskaran Singh
                   ` (18 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
function_prototypes.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/function_prototypes.ml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/function_prototypes.ml b/parsing_cocci/function_prototypes.ml
index 94dd2751a..8c6e559ac 100644
--- a/parsing_cocci/function_prototypes.ml
+++ b/parsing_cocci/function_prototypes.ml
@@ -167,6 +167,14 @@ and strip =
 	     Ast0.MetaParamList(nm,lenname,cstr,Ast0.Pure)
 	 | e -> e)) in
 
+  let attribute r k e =
+    donothing r k
+      (Ast0.rewrap e
+	 (match Ast0.unwrap e with
+	   Ast0.MetaAttribute(nm,cstr,pure) ->
+	     Ast0.MetaAttribute(nm,cstr,Ast0.Pure)
+	 | e -> e)) in
+
   V0.flat_rebuilder
     mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
     mcode mcode
@@ -174,7 +182,7 @@ and strip =
     donothing donothing
     ident donothing donothing donothing typeC donothing param
     donothing donothing donothing donothing donothing donothing donothing
-    donothing donothing
+    attribute donothing
 
 and changed_proto = function
     (mname,mdef,mproto,None) -> true
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 26/43] parsing_cocci: arity: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (24 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 25/43] parsing_cocci: function_prototypes: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 27/43] parsing_cocci: unitary_ast0: " Jaskaran Singh
                   ` (17 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
arity.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/arity.ml | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/parsing_cocci/arity.ml b/parsing_cocci/arity.ml
index 23eb32f9a..28ab8410d 100644
--- a/parsing_cocci/arity.ml
+++ b/parsing_cocci/arity.ml
@@ -259,7 +259,7 @@ let rec top_expression opt_allowed tgt expr =
 	exp_same (mcode2line lp) (List.map mcode2arity ([lp;rp])) in
       let lp = mcode lp in
       let ty = typeC arity ty in
-      let attr = List.map attribute attr in
+      let attr = List.map (attribute arity) attr in
       let rp = mcode rp in
       let exp = expression arity exp in
       make_exp expr tgt arity (Ast0.Cast(lp,ty,attr,rp,exp))
@@ -564,7 +564,7 @@ and declaration tgt decl =
       let stg = get_option mcode stg in
       let ty = typeC arity ty in
       let id = ident false arity id in
-      let attr = List.map attribute attr in
+      let attr = List.map (attribute arity) attr in
       let eq = mcode eq in
       let exp = initialiser arity exp in
       let sem = mcode sem in
@@ -577,7 +577,7 @@ and declaration tgt decl =
       let stg = get_option mcode stg in
       let ty = typeC arity ty in
       let id = ident false arity id in
-      let attr = List.map attribute attr in
+      let attr = List.map (attribute arity) attr in
       let sem = mcode sem in
       make_decl decl tgt arity (Ast0.UnInit(stg,ty,id,attr,sem))
   | Ast0.FunProto(fi,name,lp1,params,va,rp1,sem) ->
@@ -607,7 +607,7 @@ and declaration tgt decl =
       let lp = mcode lp in
       let args = dots (expression arity) args in
       let rp = mcode rp in
-      let attr = List.map attribute attr in
+      let attr = List.map (attribute arity) attr in
       let sem = mcode sem in
       make_decl decl tgt arity (Ast0.MacroDecl(stg,name,lp,args,rp,attr,sem))
   | Ast0.MacroDeclInit(stg,name,lp,args,rp,eq,ini,sem) ->
@@ -629,7 +629,7 @@ and declaration tgt decl =
 	all_same true tgt
 	  (mcode2line sem) [mcode2arity sem] in
       let ty = typeC arity ty in
-      let attr = List.map attribute attr in
+      let attr = List.map (attribute arity) attr in
       let sem = mcode sem in
       make_decl decl tgt arity (Ast0.TyDecl(ty,attr,sem))
   | Ast0.Typedef(stg,ty,id,sem) ->
@@ -818,11 +818,12 @@ and parameterTypeDef tgt param =
   let param_same = all_same true tgt in
   match Ast0.unwrap param with
     Ast0.VoidParam(ty,attr) ->
-      Ast0.rewrap param (Ast0.VoidParam(typeC tgt ty,List.map attribute attr))
+      Ast0.rewrap param
+        (Ast0.VoidParam(typeC tgt ty,List.map (attribute tgt) 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 attribute attr in
+      let attr = List.map (attribute tgt) attr in
       Ast0.rewrap param
 	(match (Ast0.unwrap ty,Ast0.unwrap id) with
 	  (Ast0.OptType(ty),Ast0.OptIdent(id)) ->
@@ -834,7 +835,7 @@ and parameterTypeDef tgt param =
 	| _ -> Ast0.Param(ty,Some id,attr))
   | Ast0.Param(ty,None,attr) ->
       let ty = top_typeC tgt true ty in
-      let attr = List.map attribute attr in
+      let attr = List.map (attribute tgt) attr in
       Ast0.rewrap param
 	(match Ast0.unwrap ty with
 	  Ast0.OptType(ty) ->
@@ -1262,7 +1263,7 @@ and fninfo arity = function
     Ast0.FStorage(stg) -> Ast0.FStorage(mcode stg)
   | Ast0.FType(ty) -> Ast0.FType(typeC arity ty)
   | Ast0.FInline(inline) -> Ast0.FInline(mcode inline)
-  | Ast0.FAttr(attr) -> Ast0.FAttr(attribute attr)
+  | Ast0.FAttr(attr) -> Ast0.FAttr(attribute arity attr)
 
 and fninfo2arity fninfo =
   List.concat
@@ -1274,10 +1275,18 @@ and fninfo2arity fninfo =
 	 | Ast0.FAttr(attr) -> [])
        fninfo)
 
-and attribute attr =
+and make_attribute =
+  make_opt
+    (function x -> failwith "opt not allowed for attributes")
+
+and attribute tgt attr =
   match Ast0.unwrap attr with
     Ast0.Attribute(a) ->
       Ast0.rewrap attr (Ast0.Attribute(mcode a))
+  | Ast0.MetaAttribute(name,cstr,pure) ->
+      let arity = all_same false tgt (mcode2line name) [mcode2arity name] in
+      let name = mcode name in
+      make_attribute attr tgt arity (Ast0.MetaAttribute(name,cstr,pure))
 
 and whencode notfn alwaysfn expression = function
     Ast0.WhenNot (w,e,a) -> Ast0.WhenNot (w,e,notfn a)
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 27/43] parsing_cocci: unitary_ast0: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (25 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 26/43] parsing_cocci: arity: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 28/43] parsing_cocci: unparse_ast0: " Jaskaran Singh
                   ` (16 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
unitary_ast0.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/unitary_ast0.ml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/unitary_ast0.ml b/parsing_cocci/unitary_ast0.ml
index fadfa4707..294dc91ff 100644
--- a/parsing_cocci/unitary_ast0.ml
+++ b/parsing_cocci/unitary_ast0.ml
@@ -174,6 +174,12 @@ let get_free checker t =
 	detect_unitary_frees(List.map r.VT0.combiner_rec_case_line case_lines)
     | _ -> k c in
 
+  let attribute r k a =
+    match Ast0.unwrap a with
+      Ast0.MetaAttribute(name,_,_) ->
+	bind (k a) (checker name)
+    | _ -> option_default in
+
   let statement r k s =
    match Ast0.unwrap s with
      Ast0.MetaStmt(name,_,_) | Ast0.MetaStmtList(name,_,_,_) ->
@@ -207,7 +213,7 @@ let get_free checker t =
       donothing donothing
       ident expression donothing donothing typeC donothing parameter
       declaration field donothing statement donothing case_line donothing
-      donothing donothing in
+      attribute donothing in
 
   collect_unitary_nonunitary
     (List.concat (List.map res.VT0.combiner_rec_top_level t))
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 28/43] parsing_cocci: unparse_ast0: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (26 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 27/43] parsing_cocci: unitary_ast0: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 29/43] parsing_cocci: ast0toast: " Jaskaran Singh
                   ` (15 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
unparse_ast0.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/unparse_ast0.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/parsing_cocci/unparse_ast0.ml b/parsing_cocci/unparse_ast0.ml
index 875282fb0..e2556cb80 100644
--- a/parsing_cocci/unparse_ast0.ml
+++ b/parsing_cocci/unparse_ast0.ml
@@ -768,6 +768,7 @@ and print_attribute_list attrs =
 and print_attribute a =
   match Ast0.unwrap a with
     Ast0.Attribute(attr) -> mcode print_string attr
+  | Ast0.MetaAttribute(name,_,_) -> mcode print_meta name
 
 and whencode notfn alwaysfn = function
     Ast0.WhenNot (_,_,a) ->
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 29/43] parsing_cocci: ast0toast: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (27 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 28/43] parsing_cocci: unparse_ast0: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 30/43] parsing_cocci: visitor_ast: " Jaskaran Singh
                   ` (14 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
ast0toast.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/ast0toast.ml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/ast0toast.ml b/parsing_cocci/ast0toast.ml
index b4b7600ed..16a2ffd30 100644
--- a/parsing_cocci/ast0toast.ml
+++ b/parsing_cocci/ast0toast.ml
@@ -1200,7 +1200,9 @@ and fninfo = function
 and attribute a =
   rewrap a no_isos
     (match Ast0.unwrap a with
-      Ast0.Attribute(attr) -> Ast.Attribute(mcode attr))
+      Ast0.Attribute(attr) -> Ast.Attribute(mcode attr)
+    | Ast0.MetaAttribute(name,cstr,_) ->
+	Ast.MetaAttribute(mcode name,constraints cstr,unitary,false))
 
 and option_to_list = function
     Some x -> [x]
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 30/43] parsing_cocci: visitor_ast: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (28 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 29/43] parsing_cocci: ast0toast: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 31/43] parsing_cocci: cleanup_rules: " Jaskaran Singh
                   ` (13 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Visit it in the SmPL AST
visitor.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/visitor_ast.ml | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml
index 17afc5183..315b94243 100644
--- a/parsing_cocci/visitor_ast.ml
+++ b/parsing_cocci/visitor_ast.ml
@@ -921,7 +921,8 @@ let combiner bind option_default
   and attribute a =
     let k a =
       match Ast.unwrap a with
-        Ast.Attribute(attr) -> string_mcode attr in
+        Ast.Attribute(attr) -> string_mcode attr
+      | Ast.MetaAttribute(name,_,_,_) -> meta_mcode name in
     attributefn all_functions k a
 
 
@@ -1919,7 +1920,9 @@ let rebuilder
     let k a =
       Ast.rewrap a
         (match Ast.unwrap a with
-          Ast.Attribute(attr) -> Ast.Attribute(string_mcode attr)) in
+          Ast.Attribute(attr) -> Ast.Attribute(string_mcode attr)
+	| Ast.MetaAttribute(name,constraints,keep,inherited) ->
+	    Ast.MetaAttribute(meta_mcode name,constraints,keep,inherited)) in
     attributefn all_functions k a
 
   and whencode notfn alwaysfn = function
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 31/43] parsing_cocci: cleanup_rules: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (29 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 30/43] parsing_cocci: visitor_ast: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 32/43] parsing_cocci: free_vars: " Jaskaran Singh
                   ` (12 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
cleanup_rules.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/cleanup_rules.ml | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/cleanup_rules.ml b/parsing_cocci/cleanup_rules.ml
index 7f03f98fd..e11484539 100644
--- a/parsing_cocci/cleanup_rules.ml
+++ b/parsing_cocci/cleanup_rules.ml
@@ -244,6 +244,14 @@ let statement r k s =
   | Ast.OptStm(_) -> s
   | _ -> k s
 
+let attribute r k a =
+  match Ast.unwrap a with
+    Ast.MetaAttribute(name,_,_,_) ->
+      (if List.mem (get_rule name) !dropped
+      then set_failed !drop_stack);
+      k a
+  | _ -> k a
+
 let do_cleanup =
   let donothing r k e = k e in
   V.rebuilder
@@ -254,7 +262,7 @@ let do_cleanup =
     ident expression string_fragment string_format assignOp
     binaryOp fullType typeC initialiser parameterTypeDef define_param
     declaration donothing field ann_field donothing
-    rule_elem statement donothing donothing donothing donothing
+    rule_elem statement donothing attribute donothing donothing
 
 let cleanup_rules rules d =
   dropped := d;
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 32/43] parsing_cocci: free_vars: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (30 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 31/43] parsing_cocci: cleanup_rules: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 33/43] parsing_cocci: get_constants: " Jaskaran Singh
                   ` (11 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
free_vars.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/free_vars.ml | 28 +++++++++++++++++++++++++---
 1 file changed, 25 insertions(+), 3 deletions(-)

diff --git a/parsing_cocci/free_vars.ml b/parsing_cocci/free_vars.ml
index 6958f48ee..404e2d549 100644
--- a/parsing_cocci/free_vars.ml
+++ b/parsing_cocci/free_vars.ml
@@ -137,6 +137,13 @@ let collect_refs include_constraints =
 	  bind (constraints cstr) [metaid name]
       | _ -> option_default) in
 
+  let astfvattribute recursor k a =
+    bind (k a)
+      (match Ast.unwrap a with
+	Ast.MetaAttribute(name,cstr,_,_) ->
+	  bind (constraints cstr) [metaid name]
+      | _ -> option_default) in
+
   let rec collect_assign_names aop =
     match Ast.unwrap aop with
       Ast.MetaAssign(name,cstr,_,_) ->
@@ -253,7 +260,8 @@ let collect_refs include_constraints =
     astfvident astfvexpr astfvfrag astfvfmt astfvassignop astfvbinaryop
     astfvfullType astfvtypeC astfvinit astfvparam astfvdefine_param
     astfvdecls donothing astfvfields astafvfields donothing
-    astfvrule_elem astfvstatement donothing donothing donothing donothing_a
+    astfvrule_elem astfvstatement donothing astfvattribute
+    donothing donothing_a
 
 let collect_all_refs = collect_refs true
 let collect_non_constraint_refs = collect_refs false
@@ -369,6 +377,12 @@ let collect_saved =
 	Ast.MetaFormat(name,_,Ast.Saved,_) -> [metaid name]
       | _ -> option_default) in
 
+  let astfvattribute recursor k a =
+    bind (k a)
+      (match Ast.unwrap a with
+	Ast.MetaAttribute(name,_,Ast.Saved,_) -> [metaid name]
+      | _ -> option_default) in
+
   let astfvassign recursor k aop =
     bind (k aop)
       (match Ast.unwrap aop with
@@ -479,7 +493,7 @@ let collect_saved =
     astfvident astfvexpr astfvfrag astfvfmt astfvassign astfvbinary donothing
     astfvtypeC astfvinit astfvparam astfvdefine_param astfvdecls donothing
     astfvfields donothing donothing astfvrule_elem donothing donothing
-    donothing donothing donothing
+    astfvattribute donothing donothing
 
 (* ---------------------------------------------------------------- *)
 
@@ -779,6 +793,14 @@ let classify_variables metavar_decls minirules used_after =
 	Ast.rewrap ft (Ast.MetaFormat(name,constraints,unitary,inherited))
     | _ -> ft in
 
+  let attribute r k a =
+    let a = k a in
+    match Ast.unwrap a with
+      Ast.MetaAttribute(name,constraints,_,_) ->
+	let (unitary,inherited) = classify name in
+	Ast.rewrap a (Ast.MetaAttribute(name,constraints,unitary,inherited))
+    | _ -> a in
+
   let assignop r k ft =
     let ft = k ft in
     match Ast.unwrap ft with
@@ -905,7 +927,7 @@ let classify_variables metavar_decls minirules used_after =
       ident expression string_fragment string_format assignop binaryop
       donothing typeC
       init param define_param decl donothing field donothing donothing
-      rule_elem donothing donothing donothing donothing donothing in
+      rule_elem donothing donothing attribute donothing donothing in
 
   List.map fn.V.rebuilder_top_level minirules
 
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 33/43] parsing_cocci: get_constants: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (31 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 32/43] parsing_cocci: free_vars: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 34/43] parsing_cocci: get_constants2: " Jaskaran Singh
                   ` (10 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
get_constants.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/get_constants.ml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/get_constants.ml b/parsing_cocci/get_constants.ml
index a23f2e4f8..ebab24871 100644
--- a/parsing_cocci/get_constants.ml
+++ b/parsing_cocci/get_constants.ml
@@ -235,6 +235,11 @@ let check_inherited nm =
     | Ast.MetaStmtList(name,_,_) -> bind (k re) (minherited name)
     | _ -> k re in
 
+  let strictattribute recursor k a =
+    match Ast.unwrap a with
+      Ast.MetaAttribute(name,_,_) -> bind (k a) (minherited name)
+    | _ -> k a in
+
   let strictstatement recursor k s =
     match Ast.unwrap s with
       Ast.Disj(stms) -> option_default
@@ -244,7 +249,7 @@ let check_inherited nm =
     mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode mcode
     donothing donothing donothing donothing
     strictident strictexpr strictfullType stricttypeC donothing strictparam
-    strictdecls strictrule_elem strictstatement donothing donothing donothing
+    strictdecls strictrule_elem strictstatement attributefn donothing donothing
 
 (* ------------------------------------------------------------------------ *)
 
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 34/43] parsing_cocci: get_constants2: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (32 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 33/43] parsing_cocci: get_constants: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 35/43] parsing_cocci: index: " Jaskaran Singh
                   ` (9 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
get_constants2.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/get_constants2.ml | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/parsing_cocci/get_constants2.ml b/parsing_cocci/get_constants2.ml
index 8fffe1955..33d8ccf5a 100644
--- a/parsing_cocci/get_constants2.ml
+++ b/parsing_cocci/get_constants2.ml
@@ -529,9 +529,10 @@ let do_get_constants constants keywords env (neg_pos,_) =
     | Ast.MetaType(name,_,_,_) -> bind (minherited name) (k ty)
     | _ -> k ty in
 
-  let attribute a =
+  let attribute r k a =
     match Ast.unwrap a with
-      Ast.Attribute(attr) -> Ast.unwrap_mcode attr in
+      Ast.MetaAttribute(name,_,_,_) -> bind (k a) (minherited name)
+    | Ast.Attribute(attr) -> constants (Ast.unwrap_mcode attr) in
 
   let declaration r k d =
     match Ast.unwrap d with
@@ -543,7 +544,7 @@ let do_get_constants constants keywords env (neg_pos,_) =
     (* need things with explicit names too *)
     | Ast.Init(_,_,_,attr,_,_,_) | Ast.UnInit(_,_,_,attr,_) ->
 	List.fold_left bind (k d)
-	  (List.map (fun attr -> constants (attribute attr)) attr)
+	  (List.map r.V.combiner_attribute attr)
     | _ -> k d in
 
   let field r k d =
@@ -645,7 +646,7 @@ let do_get_constants constants keywords env (neg_pos,_) =
     donothing donothing donothing donothing donothing donothing donothing
     ident expression string_fragment string_format donothing donothing
     fullType typeC initialiser parameter define_parameter declaration donothing
-    field ann_field donothing rule_elem statement donothing donothing donothing
+    field ann_field donothing rule_elem statement donothing attribute donothing
     donothing
 
 (* ------------------------------------------------------------------------ *)
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 35/43] parsing_cocci: index: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (33 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 34/43] parsing_cocci: get_constants2: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 36/43] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
                   ` (8 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
index.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/index.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/parsing_cocci/index.ml b/parsing_cocci/index.ml
index cb3ac7ecd..ca54bc85d 100644
--- a/parsing_cocci/index.ml
+++ b/parsing_cocci/index.ml
@@ -5,7 +5,7 @@
  *)
 
 (* create an index for each constructor *)
-(* current max is 192, also unused: 8-9, 15, 40, 42, 46, 57, 65, 85-86,
+(* current max is 192, also unused: 8-9, 15, 42, 46, 57, 65, 85-86,
  113-115, 140, 162 *)
 
 (* doesn't really work - requires that identical terms with no token
@@ -232,6 +232,7 @@ let string_fragment f =
 let attribute a =
   match Ast0.unwrap a with
     Ast0.Attribute(attr) -> [39]
+  | Ast0.MetaAttribute(name,_,_) -> [40]
 
 let top_level t =
   match Ast0.unwrap t with
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 36/43] parsing_cocci: pretty_print_cocci: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (34 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 35/43] parsing_cocci: index: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 37/43] parsing_cocci: safe_for_multi_decls: " Jaskaran Singh
                   ` (7 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
pretty_print_cocci.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/pretty_print_cocci.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/parsing_cocci/pretty_print_cocci.ml b/parsing_cocci/pretty_print_cocci.ml
index fe54a8d61..c4de73f1f 100644
--- a/parsing_cocci/pretty_print_cocci.ml
+++ b/parsing_cocci/pretty_print_cocci.ml
@@ -458,6 +458,7 @@ and print_attribute_list attrs =
 and print_attribute attr =
   match Ast.unwrap attr with
     Ast.Attribute(a) -> mcode print_string a
+  | Ast.MetaAttribute(name,_,_,_) -> mcode print_meta name
 
 and typeC ty =
   match Ast.unwrap ty with
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 37/43] parsing_cocci: safe_for_multi_decls: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (35 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 36/43] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 38/43] parsing_cocci: unify_ast: " Jaskaran Singh
                   ` (6 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
safe_for_multi_decls.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/safe_for_multi_decls.ml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/parsing_cocci/safe_for_multi_decls.ml b/parsing_cocci/safe_for_multi_decls.ml
index ee3741b96..a4ad2f36c 100644
--- a/parsing_cocci/safe_for_multi_decls.ml
+++ b/parsing_cocci/safe_for_multi_decls.ml
@@ -106,6 +106,7 @@ let contains_modif =
 let attribute a =
   match Ast.unwrap a with
     Ast.Attribute(attr) -> mcode () attr
+  | Ast.MetaAttribute(name,b,c,d) -> mcode () name
 
 let decl r k e =
   let e = k e in
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 38/43] parsing_cocci: unify_ast: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (36 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 37/43] parsing_cocci: safe_for_multi_decls: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 39/43] parsing_c: unparse_cocci: " Jaskaran Singh
                   ` (5 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
unify_ast.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_cocci/unify_ast.ml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/parsing_cocci/unify_ast.ml b/parsing_cocci/unify_ast.ml
index 98e2ab1dd..811c91f30 100644
--- a/parsing_cocci/unify_ast.ml
+++ b/parsing_cocci/unify_ast.ml
@@ -723,6 +723,8 @@ and unify_attribute attr1 attr2 =
   match (Ast.unwrap attr1,Ast.unwrap attr2) with
     (Ast.Attribute(attr1),Ast.Attribute(attr2)) ->
       unify_mcode attr1 attr2
+  | (Ast.MetaAttribute(_,_,_,_),_)
+  | (_,Ast.MetaAttribute(_,_,_,_)) -> true
 
 and unify_exec_code ec1 ec2 =
   match (Ast.unwrap ec1,Ast.unwrap ec2) with
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 39/43] parsing_c: unparse_cocci: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (37 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 38/43] parsing_cocci: unify_ast: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 40/43] engine: cocci_vs_c: " Jaskaran Singh
                   ` (4 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
unparse_cocci.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 parsing_c/unparse_cocci.ml | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml
index e544336d0..7be18bf1c 100644
--- a/parsing_c/unparse_cocci.ml
+++ b/parsing_c/unparse_cocci.ml
@@ -714,6 +714,12 @@ and print_attribute_list attrs =
 and print_attribute attr =
   match Ast.unwrap attr with
     Ast.Attribute(a) -> mcode print_string a
+  | Ast.MetaAttribute(name,_,_,_) ->
+      handle_metavar name
+	(function
+	    Ast_c.MetaAttributeVal a ->
+              pretty_print_c.Pretty_print_c.attribute a
+          | _ -> error name attr "attribute value expected")
 
 and typeC ty =
   match Ast.unwrap ty with
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 40/43] engine: cocci_vs_c: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (38 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 39/43] parsing_c: unparse_cocci: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 41/43] tools: spgen: " Jaskaran Singh
                   ` (3 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in
cocci_vs_c.ml.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 engine/cocci_vs_c.ml | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml
index ed91a4785..0b698287d 100644
--- a/engine/cocci_vs_c.ml
+++ b/engine/cocci_vs_c.ml
@@ -1535,7 +1535,8 @@ let rec (expression: (A.expression, Ast_c.expression) matcher) =
       let attr_allminus =
         let attr_is_not_context a =
           match A.unwrap a with
-          | A.Attribute(_,_,A.CONTEXT(_,_),_) -> false
+          | A.Attribute(_,_,A.CONTEXT(_,_),_)
+          | A.MetaAttribute((_,_,A.CONTEXT(_,_),_),_,_,_) -> false
           | _ -> true in
         check_allminus.Visitor_ast.combiner_fullType typa &&
         List.for_all attr_is_not_context attrsa in
@@ -4282,6 +4283,18 @@ and attribute = fun allminus ea eb ->
 	  A.rewrap ea (A.Attribute(attra)),
           (B.Attribute attrb,ib1)
         )))
+  | A.MetaAttribute (ida,constraints,keep,inherited), _ ->
+      (* todo: use quaopt, hasreg ? *)
+      let max_min _ = Lib_parsing_c.ii_of_attr eb in
+      let mn = Ast_c.MetaAttributeVal eb in
+      check_constraints constraints ida mn
+	(fun () ->
+	  X.envf keep inherited (ida,mn,max_min) (fun () ->
+            X.distrf_attr ida eb)
+	    >>= (fun ida eb ->
+	      return
+		(A.MetaAttribute(ida,constraints,keep,inherited)+>
+		 A.rewrap ea,eb)))
   | _ -> fail
 
 (*---------------------------------------------------------------------------*)
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 41/43] tools: spgen: Reflect MetaAttribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (39 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 40/43] engine: cocci_vs_c: " Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-07-26 12:51 ` [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute Jaskaran Singh
                   ` (2 subsequent siblings)
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

MetaAttribute is added to the SmPL AST. Reflect these changes in spgen.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 tools/spgen/source/meta_variable.ml | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/tools/spgen/source/meta_variable.ml b/tools/spgen/source/meta_variable.ml
index 40dcae9c2..70a9fe878 100644
--- a/tools/spgen/source/meta_variable.ml
+++ b/tools/spgen/source/meta_variable.ml
@@ -396,7 +396,6 @@ let metavar_combiner rn =
   let casefn = donothing in
   let topfn = donothing in
   let enumdeclfn = donothing in
-  let attributefn = donothing in
 
   (* --- These are shortened formatting functions that return MVSets --- *)
 
@@ -571,6 +570,13 @@ let metavar_combiner rn =
        )
     | _ -> fn v in
 
+  let attributefn c fn v =
+    match Ast0.unwrap v with
+    | Ast0.MetaAttribute(mc, idconstr, pure) ->
+        let constr = constraints ~rn idconstr in
+        meta_mc_format ~mc ~typ:"parameter " ~constr
+    | _ -> fn v in
+
   V0.flat_combiner bind option_default
     meta_mcode string_mcode const_mcode simpleAssign_mcode opAssign_mcode
     fix_mcode unary_mcode arithOp_mcode logicalOp_mcode cv_mcode sign_mcode
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (40 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 41/43] tools: spgen: " Jaskaran Singh
@ 2020-07-26 12:51 ` 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
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

Meta attributes are added to SmPL. Add test case to match and detect a
meta attribute in C code.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 tests/metaattr.c     | 5 +++++
 tests/metaattr.cocci | 9 +++++++++
 tests/metaattr.res   | 5 +++++
 3 files changed, 19 insertions(+)
 create mode 100644 tests/metaattr.c
 create mode 100644 tests/metaattr.cocci
 create mode 100644 tests/metaattr.res

diff --git a/tests/metaattr.c b/tests/metaattr.c
new file mode 100644
index 000000000..d3b091cd9
--- /dev/null
+++ b/tests/metaattr.c
@@ -0,0 +1,5 @@
+int main() {
+	int b __attr__ = 1;
+	int b = 1;
+	return 0;
+}
diff --git a/tests/metaattr.cocci b/tests/metaattr.cocci
new file mode 100644
index 000000000..a325ad06f
--- /dev/null
+++ b/tests/metaattr.cocci
@@ -0,0 +1,9 @@
+@@
+attribute name __attr__;
+attribute a;
+identifier b;
+@@
+
+-	int
++	char
+  b a = 1;
diff --git a/tests/metaattr.res b/tests/metaattr.res
new file mode 100644
index 000000000..9cd2014f2
--- /dev/null
+++ b/tests/metaattr.res
@@ -0,0 +1,5 @@
+int main() {
+	char b __attr__ = 1;
+	int b = 1;
+	return 0;
+}
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* [Cocci] [PATCH 43/43] tests: Add test case to remove a meta attribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (41 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  2020-08-01 20:36 ` [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Julia Lawall
  43 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

Meta attributes are added to SmPL. Add a test case to match and remove a
meta attribute from C code.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 tests/remove_metaattr.c     | 5 +++++
 tests/remove_metaattr.cocci | 9 +++++++++
 tests/remove_metaattr.res   | 5 +++++
 3 files changed, 19 insertions(+)
 create mode 100644 tests/remove_metaattr.c
 create mode 100644 tests/remove_metaattr.cocci
 create mode 100644 tests/remove_metaattr.res

diff --git a/tests/remove_metaattr.c b/tests/remove_metaattr.c
new file mode 100644
index 000000000..d3b091cd9
--- /dev/null
+++ b/tests/remove_metaattr.c
@@ -0,0 +1,5 @@
+int main() {
+	int b __attr__ = 1;
+	int b = 1;
+	return 0;
+}
diff --git a/tests/remove_metaattr.cocci b/tests/remove_metaattr.cocci
new file mode 100644
index 000000000..e35bc7e3c
--- /dev/null
+++ b/tests/remove_metaattr.cocci
@@ -0,0 +1,9 @@
+@@
+attribute name __attr__;
+attribute a;
+identifier b;
+@@
+
+int b
+-	a
+	= 1;
diff --git a/tests/remove_metaattr.res b/tests/remove_metaattr.res
new file mode 100644
index 000000000..7d9292a55
--- /dev/null
+++ b/tests/remove_metaattr.res
@@ -0,0 +1,5 @@
+int main() {
+	int b = 1;
+	int b = 1;
+	return 0;
+}
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
                   ` (42 preceding siblings ...)
  2020-07-26 12:51 ` [Cocci] [PATCH 43/43] tests: Add test case to remove a " Jaskaran Singh
@ 2020-08-01 20:36 ` Julia Lawall
  2020-08-02 12:16   ` Jaskaran Singh
  43 siblings, 1 reply; 46+ messages in thread
From: Julia Lawall @ 2020-08-01 20:36 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: cocci



On Sun, 26 Jul 2020, Jaskaran Singh wrote:

> This patch series aims to add support for meta attributes in SmPL.
> Currently, only meta attributes in context and minus code are supported.
>
> Changes include adding the MetaAttribute and MetaAttributeDecl constructors to
> the SmPL ASTs and the MetaAttributeVal constructor to the C AST.
>
> Two test cases are included for detecting and removing meta attributes.

Applied.

Is this the end of atributes?

julia

>
> Jaskaran Singh (43):
>       parsing_cocci: ast0_cocci: Add MetaAttribute & MetaAttributeDecl
>       parsing_cocci: parser: Parse meta attributes and metaattr decls
>       parsing_cocci: parse_cocci: Reflect MetaAttribute & MetaAttributeDecl
>       parsing_cocci: ast_cocci: Add MetaAttribute & MetaAttributeDecl
>       parsing_cocci: iso_pattern: Reflect MetaAttribute & MetaAttributeDecl
>       parsing_c: unparse_hrule: Reflect MetaAttribute & MetaAttributeDecl
>       parsing_cocci: pretty_print_cocci: Reflect MetaAttribute & MetaAttributeDecl
>       ocaml: coccilib: Reflect MetaAttribute & MetaAttributeDecl
>       ocaml: yes_prepare_ocamlcocci: Reflect MetaAttribute & MetaAttributeDecl
>       parsing_c: ast_c: Add MetaAttributeVal
>       parsing_c: unparse_hrule: Reflect MetaAttributeVal
>       engine: cocci_vs_c: Reflect MetaAttributeVal
>       engine: pattern_c: Reflect MetaAttributeVal
>       engine: pretty_print_engine: Add MetaAttributeVal
>       ocaml: coccilib: Reflect MetaAttributeVal
>       ocaml: ocamlcocci_aux: Reflect MetaAttributeVal
>       ocaml: run_ocamlcocci: Reflect MetaAttributeVal
>       python: pycocci_aux: Reflect MetaAttributeVal
>       parsing_cocci: visitor_ast0: Reflect MetaAttribute
>       parsing_cocci: check_meta: Reflect MetaAttribute
>       parsing_cocci: adjust_pragmas: Reflect MetaAttribute
>       parsing_cocci: context_neg: Reflect MetaAttribute
>       parsing_cocci: compute_lines: Reflect MetaAttribute
>       parsing_cocci: iso_pattern: Reflect MetaAttribute
>       parsing_cocci: function_prototypes: Reflect MetaAttribute
>       parsing_cocci: arity: Reflect MetaAttribute
>       parsing_cocci: unitary_ast0: Reflect MetaAttribute
>       parsing_cocci: unparse_ast0: Reflect MetaAttribute
>       parsing_cocci: ast0toast: Reflect MetaAttribute
>       parsing_cocci: visitor_ast: Reflect MetaAttribute
>       parsing_cocci: cleanup_rules: Reflect MetaAttribute
>       parsing_cocci: free_vars: Reflect MetaAttribute
>       parsing_cocci: get_constants: Reflect MetaAttribute
>       parsing_cocci: get_constants2: Reflect MetaAttribute
>       parsing_cocci: index: Reflect MetaAttribute
>       parsing_cocci: pretty_print_cocci: Reflect MetaAttribute
>       parsing_cocci: safe_for_multi_decls: Reflect MetaAttribute
>       parsing_cocci: unify_ast: Reflect MetaAttribute
>       parsing_c: unparse_cocci: Reflect MetaAttribute
>       engine: cocci_vs_c: Reflect MetaAttribute
>       tools: spgen: Reflect MetaAttribute
>       tests: Add test case to match meta attribute
>       tests: Add test case to remove a meta attribute
>
>  engine/cocci_vs_c.ml                  |   23 ++++++++++++++---
>  engine/pattern_c.ml                   |    6 ++++
>  engine/pretty_print_engine.ml         |    1
>  ocaml/coccilib.ml                     |    1
>  ocaml/coccilib.mli                    |    7 +++++
>  ocaml/ocamlcocci_aux.ml               |    2 +
>  ocaml/run_ocamlcocci.ml               |    1
>  ocaml/yes_prepare_ocamlcocci.ml       |    1
>  parsing_c/ast_c.ml                    |    1
>  parsing_c/ast_c.mli                   |    1
>  parsing_c/lib_parsing_c.ml            |    3 ++
>  parsing_c/lib_parsing_c.mli           |    3 ++
>  parsing_c/pretty_print_c.ml           |   12 ++++++++
>  parsing_c/pretty_print_c.mli          |    5 +++
>  parsing_c/unparse_cocci.ml            |    6 ++++
>  parsing_c/unparse_hrule.ml            |    5 +++
>  parsing_cocci/adjust_pragmas.ml       |    3 ++
>  parsing_cocci/arity.ml                |   29 ++++++++++++++-------
>  parsing_cocci/ast0_cocci.ml           |    1
>  parsing_cocci/ast0_cocci.mli          |    1
>  parsing_cocci/ast0toast.ml            |    4 ++
>  parsing_cocci/ast_cocci.ml            |    3 ++
>  parsing_cocci/ast_cocci.mli           |    2 +
>  parsing_cocci/check_meta.ml           |   27 ++++++++++++++-----
>  parsing_cocci/cleanup_rules.ml        |   10 ++++++-
>  parsing_cocci/compute_lines.ml        |   14 ++++++----
>  parsing_cocci/context_neg.ml          |   18 ++++++++-----
>  parsing_cocci/data.ml                 |    1
>  parsing_cocci/data.mli                |    1
>  parsing_cocci/free_vars.ml            |   28 ++++++++++++++++++--
>  parsing_cocci/function_prototypes.ml  |   10 ++++++-
>  parsing_cocci/get_constants.ml        |    7 ++++-
>  parsing_cocci/get_constants2.ml       |    9 +++---
>  parsing_cocci/index.ml                |    3 +-
>  parsing_cocci/iso_pattern.ml          |   46 +++++++++++++++++++++++++++++-----
>  parsing_cocci/lexer_cocci.mll         |   12 ++++++++
>  parsing_cocci/parse_aux.ml            |    4 ++
>  parsing_cocci/parse_cocci.ml          |   11 ++++++--
>  parsing_cocci/parser_cocci_menhir.mly |   25 ++++++++++++------
>  parsing_cocci/pretty_print_cocci.ml   |    3 ++
>  parsing_cocci/safe_for_multi_decls.ml |    1
>  parsing_cocci/unify_ast.ml            |    2 +
>  parsing_cocci/unitary_ast0.ml         |    8 +++++
>  parsing_cocci/unparse_ast0.ml         |    1
>  parsing_cocci/visitor_ast.ml          |    7 +++--
>  parsing_cocci/visitor_ast0.ml         |    5 ++-
>  python/pycocci_aux.ml                 |    2 +
>  tests/metaattr.c                      |    5 +++
>  tests/metaattr.cocci                  |    9 ++++++
>  tests/metaattr.res                    |    5 +++
>  tests/remove_metaattr.c               |    5 +++
>  tests/remove_metaattr.cocci           |    9 ++++++
>  tests/remove_metaattr.res             |    5 +++
>  tools/spgen/source/meta_variable.ml   |    8 +++++
>  54 files changed, 357 insertions(+), 65 deletions(-)
>
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL
  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
  0 siblings, 0 replies; 46+ messages in thread
From: Jaskaran Singh @ 2020-08-02 12:16 UTC (permalink / raw)
  To: Julia Lawall; +Cc: cocci

On Sat, 2020-08-01 at 22:36 +0200, Julia Lawall wrote:
> 
> On Sun, 26 Jul 2020, Jaskaran Singh wrote:
> 
> > This patch series aims to add support for meta attributes in SmPL.
> > Currently, only meta attributes in context and minus code are
> > supported.
> > 
> > Changes include adding the MetaAttribute and MetaAttributeDecl
> > constructors to
> > the SmPL ASTs and the MetaAttributeVal constructor to the C AST.
> > 
> > Two test cases are included for detecting and removing meta
> > attributes.
> 
> Applied.
> 
> Is this the end of atributes?
> 

There are a few more patches, but not as wide as this.

Cheers,
Jaskaran.

> julia
> 
> > Jaskaran Singh (43):
> >       parsing_cocci: ast0_cocci: Add MetaAttribute &
> > MetaAttributeDecl
> >       parsing_cocci: parser: Parse meta attributes and metaattr
> > decls
> >       parsing_cocci: parse_cocci: Reflect MetaAttribute &
> > MetaAttributeDecl
> >       parsing_cocci: ast_cocci: Add MetaAttribute &
> > MetaAttributeDecl
> >       parsing_cocci: iso_pattern: Reflect MetaAttribute &
> > MetaAttributeDecl
> >       parsing_c: unparse_hrule: Reflect MetaAttribute &
> > MetaAttributeDecl
> >       parsing_cocci: pretty_print_cocci: Reflect MetaAttribute &
> > MetaAttributeDecl
> >       ocaml: coccilib: Reflect MetaAttribute & MetaAttributeDecl
> >       ocaml: yes_prepare_ocamlcocci: Reflect MetaAttribute &
> > MetaAttributeDecl
> >       parsing_c: ast_c: Add MetaAttributeVal
> >       parsing_c: unparse_hrule: Reflect MetaAttributeVal
> >       engine: cocci_vs_c: Reflect MetaAttributeVal
> >       engine: pattern_c: Reflect MetaAttributeVal
> >       engine: pretty_print_engine: Add MetaAttributeVal
> >       ocaml: coccilib: Reflect MetaAttributeVal
> >       ocaml: ocamlcocci_aux: Reflect MetaAttributeVal
> >       ocaml: run_ocamlcocci: Reflect MetaAttributeVal
> >       python: pycocci_aux: Reflect MetaAttributeVal
> >       parsing_cocci: visitor_ast0: Reflect MetaAttribute
> >       parsing_cocci: check_meta: Reflect MetaAttribute
> >       parsing_cocci: adjust_pragmas: Reflect MetaAttribute
> >       parsing_cocci: context_neg: Reflect MetaAttribute
> >       parsing_cocci: compute_lines: Reflect MetaAttribute
> >       parsing_cocci: iso_pattern: Reflect MetaAttribute
> >       parsing_cocci: function_prototypes: Reflect MetaAttribute
> >       parsing_cocci: arity: Reflect MetaAttribute
> >       parsing_cocci: unitary_ast0: Reflect MetaAttribute
> >       parsing_cocci: unparse_ast0: Reflect MetaAttribute
> >       parsing_cocci: ast0toast: Reflect MetaAttribute
> >       parsing_cocci: visitor_ast: Reflect MetaAttribute
> >       parsing_cocci: cleanup_rules: Reflect MetaAttribute
> >       parsing_cocci: free_vars: Reflect MetaAttribute
> >       parsing_cocci: get_constants: Reflect MetaAttribute
> >       parsing_cocci: get_constants2: Reflect MetaAttribute
> >       parsing_cocci: index: Reflect MetaAttribute
> >       parsing_cocci: pretty_print_cocci: Reflect MetaAttribute
> >       parsing_cocci: safe_for_multi_decls: Reflect MetaAttribute
> >       parsing_cocci: unify_ast: Reflect MetaAttribute
> >       parsing_c: unparse_cocci: Reflect MetaAttribute
> >       engine: cocci_vs_c: Reflect MetaAttribute
> >       tools: spgen: Reflect MetaAttribute
> >       tests: Add test case to match meta attribute
> >       tests: Add test case to remove a meta attribute
> > 
> >  engine/cocci_vs_c.ml                  |   23 ++++++++++++++---
> >  engine/pattern_c.ml                   |    6 ++++
> >  engine/pretty_print_engine.ml         |    1
> >  ocaml/coccilib.ml                     |    1
> >  ocaml/coccilib.mli                    |    7 +++++
> >  ocaml/ocamlcocci_aux.ml               |    2 +
> >  ocaml/run_ocamlcocci.ml               |    1
> >  ocaml/yes_prepare_ocamlcocci.ml       |    1
> >  parsing_c/ast_c.ml                    |    1
> >  parsing_c/ast_c.mli                   |    1
> >  parsing_c/lib_parsing_c.ml            |    3 ++
> >  parsing_c/lib_parsing_c.mli           |    3 ++
> >  parsing_c/pretty_print_c.ml           |   12 ++++++++
> >  parsing_c/pretty_print_c.mli          |    5 +++
> >  parsing_c/unparse_cocci.ml            |    6 ++++
> >  parsing_c/unparse_hrule.ml            |    5 +++
> >  parsing_cocci/adjust_pragmas.ml       |    3 ++
> >  parsing_cocci/arity.ml                |   29 ++++++++++++++-------
> >  parsing_cocci/ast0_cocci.ml           |    1
> >  parsing_cocci/ast0_cocci.mli          |    1
> >  parsing_cocci/ast0toast.ml            |    4 ++
> >  parsing_cocci/ast_cocci.ml            |    3 ++
> >  parsing_cocci/ast_cocci.mli           |    2 +
> >  parsing_cocci/check_meta.ml           |   27 ++++++++++++++-----
> >  parsing_cocci/cleanup_rules.ml        |   10 ++++++-
> >  parsing_cocci/compute_lines.ml        |   14 ++++++----
> >  parsing_cocci/context_neg.ml          |   18 ++++++++-----
> >  parsing_cocci/data.ml                 |    1
> >  parsing_cocci/data.mli                |    1
> >  parsing_cocci/free_vars.ml            |   28 ++++++++++++++++++--
> >  parsing_cocci/function_prototypes.ml  |   10 ++++++-
> >  parsing_cocci/get_constants.ml        |    7 ++++-
> >  parsing_cocci/get_constants2.ml       |    9 +++---
> >  parsing_cocci/index.ml                |    3 +-
> >  parsing_cocci/iso_pattern.ml          |   46
> > +++++++++++++++++++++++++++++-----
> >  parsing_cocci/lexer_cocci.mll         |   12 ++++++++
> >  parsing_cocci/parse_aux.ml            |    4 ++
> >  parsing_cocci/parse_cocci.ml          |   11 ++++++--
> >  parsing_cocci/parser_cocci_menhir.mly |   25 ++++++++++++------
> >  parsing_cocci/pretty_print_cocci.ml   |    3 ++
> >  parsing_cocci/safe_for_multi_decls.ml |    1
> >  parsing_cocci/unify_ast.ml            |    2 +
> >  parsing_cocci/unitary_ast0.ml         |    8 +++++
> >  parsing_cocci/unparse_ast0.ml         |    1
> >  parsing_cocci/visitor_ast.ml          |    7 +++--
> >  parsing_cocci/visitor_ast0.ml         |    5 ++-
> >  python/pycocci_aux.ml                 |    2 +
> >  tests/metaattr.c                      |    5 +++
> >  tests/metaattr.cocci                  |    9 ++++++
> >  tests/metaattr.res                    |    5 +++
> >  tests/remove_metaattr.c               |    5 +++
> >  tests/remove_metaattr.cocci           |    9 ++++++
> >  tests/remove_metaattr.res             |    5 +++
> >  tools/spgen/source/meta_variable.ml   |    8 +++++
> >  54 files changed, 357 insertions(+), 65 deletions(-)
> > 
> > 
> > 

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

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2020-08-02 12:16 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [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

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).