* [Cocci] [PATCH 01/24] parsing_cocci: visitor_ast0: Add attributefn to SmPL AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 02/24] parsing_cocci: ast0toast: Reflect attributefn in " Jaskaran Singh
` (23 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
Add a public function for visiting attributes to the SmPL AST0 visitor.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/visitor_ast0.ml | 21 +++++++++++++++++----
parsing_cocci/visitor_ast0.mli | 2 ++
parsing_cocci/visitor_ast0_types.ml | 6 ++++++
parsing_cocci/visitor_ast0_types.mli | 6 ++++++
4 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml
index a5902f8c..090fe625 100644
--- a/parsing_cocci/visitor_ast0.ml
+++ b/parsing_cocci/visitor_ast0.ml
@@ -25,7 +25,7 @@ let visitor mode bind option_default
dotsenumdeclfn dotscasefn dotsdefparfn
identfn exprfn assignOpfn binaryOpfn tyfn initfn paramfn declfn fieldfn
enumdeclfn
- stmtfn forinfofn casefn string_fragmentfn topfn =
+ stmtfn forinfofn casefn string_fragmentfn attributefn topfn =
let multibind l =
let rec loop = function
[] -> option_default
@@ -1155,7 +1155,7 @@ let visitor mode bind option_default
Ast0.Attribute(attr) ->
let (attr_n,attr) = string_mcode attr in
(attr_n,Ast0.Attribute(attr))) in
- k a
+ attributefn all_functions k a
(* we only include the when string mcode w because the parameterised
string_mcodefn function might have side-effects *)
@@ -1370,6 +1370,7 @@ let visitor mode bind option_default
VT0.case_line = case_line;
VT0.define_param = define_param;
VT0.string_fragment = string_fragment;
+ VT0.attribute = attribute;
VT0.top_level = top_level;
VT0.expression_dots = expression_dots;
VT0.statement_dots = statement_dots;
@@ -1419,6 +1420,7 @@ let combiner_functions =
VT0.combiner_forinfofn = (fun r k e -> k e);
VT0.combiner_casefn = (fun r k e -> k e);
VT0.combiner_string_fragmentfn = (fun r k e -> k e);
+ VT0.combiner_attributefn = (fun r k e -> k e);
VT0.combiner_topfn = (fun r k e -> k e)}
let combiner_dz r =
@@ -1458,6 +1460,8 @@ let combiner_dz r =
(function e -> let (n,_) = r.VT0.define_param e in n);
VT0.combiner_rec_string_fragment =
(function e -> let (n,_) = r.VT0.string_fragment e in n);
+ VT0.combiner_rec_attribute =
+ (function e -> let (n,_) = r.VT0.attribute e in n);
VT0.combiner_rec_top_level =
(function e -> let (n,_) = r.VT0.top_level e in n);
VT0.combiner_rec_expression_dots =
@@ -1524,6 +1528,7 @@ let combiner bind option_default functions =
(fun r k e -> (functions.VT0.combiner_forinfofn (dz r) (xk k) e, e))
(fun r k e -> (functions.VT0.combiner_casefn (dz r) (xk k) e, e))
(fun r k e -> (functions.VT0.combiner_string_fragmentfn (dz r) (xk k) e,e))
+ (fun r k e -> (functions.VT0.combiner_attributefn (dz r) (xk k) e, e))
(fun r k e -> (functions.VT0.combiner_topfn (dz r) (xk k) e, e)))
let flat_combiner bind option_default
@@ -1534,7 +1539,7 @@ let flat_combiner bind option_default
dotsenumdeclfn dotscasefn dotsdefparfn
identfn exprfn assignOpfn binaryOpfn tyfn initfn paramfn declfn fieldfn
enumdeclfn
- stmtfn forinfofn casefn string_fragmentfn topfn =
+ stmtfn forinfofn casefn string_fragmentfn attributefn topfn =
let dz = combiner_dz in
let xk k e = let (n,_) = k e in n in
combiner_dz (visitor COMBINER bind option_default
@@ -1575,6 +1580,7 @@ let flat_combiner bind option_default
(fun r k e -> (forinfofn (dz r) (xk k) e, e))
(fun r k e -> (casefn (dz r) (xk k) e, e))
(fun r k e -> (string_fragmentfn (dz r) (xk k) e, e))
+ (fun r k e -> (attributefn (dz r) (xk k) e, e))
(fun r k e -> (topfn (dz r) (xk k) e, e)))
let rebuilder_functions =
@@ -1615,6 +1621,7 @@ let rebuilder_functions =
VT0.rebuilder_forinfofn = (fun r k e -> k e);
VT0.rebuilder_casefn = (fun r k e -> k e);
VT0.rebuilder_string_fragmentfn = (fun r k e -> k e);
+ VT0.rebuilder_attributefn = (fun r k e -> k e);
VT0.rebuilder_topfn = (fun r k e -> k e)}
let rebuilder_dz r =
@@ -1652,6 +1659,8 @@ let rebuilder_dz r =
(function e -> let (_,e) = r.VT0.case_line e in e);
VT0.rebuilder_rec_string_fragment =
(function e -> let (_,e) = r.VT0.string_fragment e in e);
+ VT0.rebuilder_rec_attribute =
+ (function e -> let (_,e) = r.VT0.attribute e in e);
VT0.rebuilder_rec_top_level =
(function e -> let (_,e) = r.VT0.top_level e in e);
VT0.rebuilder_rec_expression_dots =
@@ -1714,6 +1723,7 @@ let rebuilder functions =
(fun r k e -> ((),functions.VT0.rebuilder_casefn (dz r) (xk k) e))
(fun r k e ->
((),functions.VT0.rebuilder_string_fragmentfn (dz r) (xk k) e))
+ (fun r k e -> ((),functions.VT0.rebuilder_attributefn (dz r) (xk k) e))
(fun r k e -> ((),functions.VT0.rebuilder_topfn (dz r) (xk k) e)))
let flat_rebuilder
@@ -1725,7 +1735,7 @@ let flat_rebuilder
dotsenumdeclfn dotscasefn dotsdefparfn
identfn exprfn assignOpfn arithOpfn tyfn initfn paramfn declfn fieldfn
enumdeclfn
- stmtfn forinfofn casefn string_fragmentfn topfn =
+ stmtfn forinfofn casefn string_fragmentfn attributefn topfn =
let dz = rebuilder_dz in
let xk k e = let (_,e) = k e in e in
rebuilder_dz
@@ -1767,6 +1777,7 @@ let flat_rebuilder
(fun r k e -> ((),forinfofn (dz r) (xk k) e))
(fun r k e -> ((),casefn (dz r) (xk k) e))
(fun r k e -> ((),string_fragmentfn (dz r) (xk k) e))
+ (fun r k e -> ((),attributefn (dz r) (xk k) e))
(fun r k e -> ((),topfn (dz r) (xk k) e)))
let combiner_rebuilder_functions =
@@ -1821,6 +1832,7 @@ let combiner_rebuilder_functions =
VT0.combiner_rebuilder_forinfofn = (fun r k e -> k e);
VT0.combiner_rebuilder_casefn = (fun r k e -> k e);
VT0.combiner_rebuilder_string_fragmentfn = (fun r k e -> k e);
+ VT0.combiner_rebuilder_attributefn = (fun r k e -> k e);
VT0.combiner_rebuilder_topfn = (fun r k e -> k e)}
let combiner_rebuilder bind option_default functions =
@@ -1862,4 +1874,5 @@ let combiner_rebuilder bind option_default functions =
functions.VT0.combiner_rebuilder_forinfofn
functions.VT0.combiner_rebuilder_casefn
functions.VT0.combiner_rebuilder_string_fragmentfn
+ functions.VT0.combiner_rebuilder_attributefn
functions.VT0.combiner_rebuilder_topfn
diff --git a/parsing_cocci/visitor_ast0.mli b/parsing_cocci/visitor_ast0.mli
index e801c983..53d51e4a 100644
--- a/parsing_cocci/visitor_ast0.mli
+++ b/parsing_cocci/visitor_ast0.mli
@@ -50,6 +50,7 @@ val flat_combiner :
((Ast0_cocci.forinfo,'a) Visitor_ast0_types.ccode) ->
((Ast0_cocci.case_line,'a) Visitor_ast0_types.ccode) ->
((Ast0_cocci.string_fragment,'a) Visitor_ast0_types.ccode) ->
+ ((Ast0_cocci.attr,'a) Visitor_ast0_types.ccode) ->
((Ast0_cocci.top_level,'a) Visitor_ast0_types.ccode) ->
'a Visitor_ast0_types.combiner_rec_functions
@@ -95,6 +96,7 @@ val flat_rebuilder :
(Ast0_cocci.forinfo Visitor_ast0_types.rcode) ->
(Ast0_cocci.case_line Visitor_ast0_types.rcode) ->
(Ast0_cocci.string_fragment Visitor_ast0_types.rcode) ->
+ (Ast0_cocci.attr Visitor_ast0_types.rcode) ->
(Ast0_cocci.top_level Visitor_ast0_types.rcode) ->
Visitor_ast0_types.rebuilder_rec_functions
diff --git a/parsing_cocci/visitor_ast0_types.ml b/parsing_cocci/visitor_ast0_types.ml
index 7a00c702..65892483 100644
--- a/parsing_cocci/visitor_ast0_types.ml
+++ b/parsing_cocci/visitor_ast0_types.ml
@@ -28,6 +28,7 @@ type 'n all_functions =
case_line : (Ast0.case_line,'n) inout;
define_param : (Ast0.define_param,'n) inout;
string_fragment : (Ast0.string_fragment,'n) inout;
+ attribute : (Ast0.attr,'n) inout;
top_level : (Ast0.top_level,'n) inout;
expression_dots : (Ast0.expression Ast0.dots,'n) inout;
statement_dots : (Ast0.statement Ast0.dots,'n) inout;
@@ -63,6 +64,7 @@ type 'n combiner_rec_functions =
combiner_rec_case_line : (Ast0.case_line,'n) combiner_inout;
combiner_rec_define_param : (Ast0.define_param,'n) combiner_inout;
combiner_rec_string_fragment : (Ast0.string_fragment,'n) combiner_inout;
+ combiner_rec_attribute : (Ast0.attr,'n) combiner_inout;
combiner_rec_top_level : (Ast0.top_level,'n) combiner_inout;
combiner_rec_expression_dots :
(Ast0.expression Ast0.dots,'n) combiner_inout;
@@ -122,6 +124,7 @@ type 'n combiner_functions =
combiner_forinfofn : (Ast0.forinfo,'n) ccode;
combiner_casefn : (Ast0.case_line,'n) ccode;
combiner_string_fragmentfn : (Ast0.string_fragment,'n) ccode;
+ combiner_attributefn : (Ast0.attr,'n) ccode;
combiner_topfn : (Ast0.top_level,'n) ccode}
(* ----------------------------------------------------------------------- *)
@@ -148,6 +151,7 @@ type rebuilder_rec_functions =
rebuilder_rec_forinfo : Ast0.forinfo rebuilder_inout;
rebuilder_rec_case_line : Ast0.case_line rebuilder_inout;
rebuilder_rec_string_fragment : Ast0.string_fragment rebuilder_inout;
+ rebuilder_rec_attribute : Ast0.attr rebuilder_inout;
rebuilder_rec_top_level : Ast0.top_level rebuilder_inout;
rebuilder_rec_expression_dots :
Ast0.expression Ast0.dots rebuilder_inout;
@@ -208,6 +212,7 @@ type rebuilder_functions =
rebuilder_forinfofn : Ast0.forinfo rcode;
rebuilder_casefn : Ast0.case_line rcode;
rebuilder_string_fragmentfn : Ast0.string_fragment rcode;
+ rebuilder_attributefn : Ast0.attr rcode;
rebuilder_topfn : Ast0.top_level rcode}
(* ----------------------------------------------------------------------- *)
@@ -256,4 +261,5 @@ type 'n combiner_rebuilder_functions =
combiner_rebuilder_forinfofn : (Ast0.forinfo,'n) rccode;
combiner_rebuilder_casefn : (Ast0.case_line,'n) rccode;
combiner_rebuilder_string_fragmentfn : (Ast0.string_fragment,'n) rccode;
+ combiner_rebuilder_attributefn : (Ast0.attr,'n) rccode;
combiner_rebuilder_topfn : (Ast0.top_level,'n) rccode}
diff --git a/parsing_cocci/visitor_ast0_types.mli b/parsing_cocci/visitor_ast0_types.mli
index d06baaf7..7c7c31aa 100644
--- a/parsing_cocci/visitor_ast0_types.mli
+++ b/parsing_cocci/visitor_ast0_types.mli
@@ -18,6 +18,7 @@ type 'n all_functions = {
case_line : (Ast0_cocci.case_line, 'n) inout;
define_param : (Ast0_cocci.define_param, 'n) inout;
string_fragment : (Ast0_cocci.string_fragment, 'n) inout;
+ attribute : (Ast0_cocci.attr, 'n) inout;
top_level : (Ast0_cocci.top_level, 'n) inout;
expression_dots : (Ast0_cocci.expression Ast0_cocci.dots, 'n) inout;
statement_dots : (Ast0_cocci.statement Ast0_cocci.dots, 'n) inout;
@@ -48,6 +49,7 @@ type 'n combiner_rec_functions = {
combiner_rec_case_line : (Ast0_cocci.case_line, 'n) combiner_inout;
combiner_rec_define_param : (Ast0_cocci.define_param, 'n) combiner_inout;
combiner_rec_string_fragment : (Ast0_cocci.string_fragment, 'n) combiner_inout;
+ combiner_rec_attribute : (Ast0_cocci.attr, 'n) combiner_inout;
combiner_rec_top_level : (Ast0_cocci.top_level, 'n) combiner_inout;
combiner_rec_expression_dots :
(Ast0_cocci.expression Ast0_cocci.dots, 'n) combiner_inout;
@@ -102,6 +104,7 @@ type 'n combiner_functions = {
combiner_forinfofn : (Ast0_cocci.forinfo, 'n) ccode;
combiner_casefn : (Ast0_cocci.case_line, 'n) ccode;
combiner_string_fragmentfn : (Ast0_cocci.string_fragment, 'n) ccode;
+ combiner_attributefn : (Ast0_cocci.attr, 'n) ccode;
combiner_topfn : (Ast0_cocci.top_level, 'n) ccode;
}
type 'a rebuilder_inout = 'a -> 'a
@@ -123,6 +126,7 @@ type rebuilder_rec_functions = {
rebuilder_rec_forinfo : Ast0_cocci.forinfo rebuilder_inout;
rebuilder_rec_case_line : Ast0_cocci.case_line rebuilder_inout;
rebuilder_rec_string_fragment : Ast0_cocci.string_fragment rebuilder_inout;
+ rebuilder_rec_attribute : Ast0_cocci.attr rebuilder_inout;
rebuilder_rec_top_level : Ast0_cocci.top_level rebuilder_inout;
rebuilder_rec_expression_dots : Ast0_cocci.expression Ast0_cocci.dots rebuilder_inout;
rebuilder_rec_statement_dots : Ast0_cocci.statement Ast0_cocci.dots rebuilder_inout;
@@ -175,6 +179,7 @@ type rebuilder_functions = {
rebuilder_forinfofn : Ast0_cocci.forinfo rcode;
rebuilder_casefn : Ast0_cocci.case_line rcode;
rebuilder_string_fragmentfn : Ast0_cocci.string_fragment rcode;
+ rebuilder_attributefn : Ast0_cocci.attr rcode;
rebuilder_topfn : Ast0_cocci.top_level rcode;
}
type ('mc, 'a) rcmcode = 'a -> 'mc Ast0_cocci.mcode -> 'a * 'mc Ast0_cocci.mcode
@@ -219,5 +224,6 @@ type 'n combiner_rebuilder_functions = {
combiner_rebuilder_forinfofn : (Ast0_cocci.forinfo, 'n) rccode;
combiner_rebuilder_casefn : (Ast0_cocci.case_line, 'n) rccode;
combiner_rebuilder_string_fragmentfn : (Ast0_cocci.string_fragment, 'n) rccode;
+ combiner_rebuilder_attributefn : (Ast0_cocci.attr, 'n) rccode;
combiner_rebuilder_topfn : (Ast0_cocci.top_level, 'n) rccode;
}
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 02/24] parsing_cocci: ast0toast: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 01/24] parsing_cocci: visitor_ast0: Add attributefn to " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 03/24] parsing_cocci: check_meta: " Jaskaran Singh
` (22 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in ast0toast.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/ast0toast.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/parsing_cocci/ast0toast.ml b/parsing_cocci/ast0toast.ml
index f0cad067..4ccc259b 100644
--- a/parsing_cocci/ast0toast.ml
+++ b/parsing_cocci/ast0toast.ml
@@ -190,7 +190,7 @@ let inline_mcodes =
do_nothing do_nothing
do_nothing do_nothing do_nothing do_nothing do_nothing do_nothing
do_nothing do_nothing do_nothing_end do_nothing_end do_nothing do_nothing
- do_nothing do_nothing do_nothing do_nothing
+ do_nothing do_nothing do_nothing do_nothing do_nothing
(* --------------------------------------------------------------------- *)
(* For function declarations. Can't use the mcode at the root, because that
@@ -274,7 +274,7 @@ let check_allminus =
donothing
donothing ident expression donothing donothing typeC initialiser donothing
declaration field donothing statement donothing case_line donothing
- donothing
+ 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] 26+ messages in thread
* [Cocci] [PATCH 03/24] parsing_cocci: check_meta: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 01/24] parsing_cocci: visitor_ast0: Add attributefn to " Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 02/24] parsing_cocci: ast0toast: Reflect attributefn in " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 04/24] parsing_cocci: function_prototypes: " Jaskaran Singh
` (21 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in check_meta.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/check_meta.ml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/parsing_cocci/check_meta.ml b/parsing_cocci/check_meta.ml
index f651ff8b..342cbd87 100644
--- a/parsing_cocci/check_meta.ml
+++ b/parsing_cocci/check_meta.ml
@@ -597,7 +597,7 @@ let positions rname table rules =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing in
+ donothing donothing donothing donothing in
List.iter fn.VT0.combiner_rec_top_level rules
@@ -667,7 +667,7 @@ let dup_positions rules =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing expression donothing donothing typeC
donothing donothing declaration field donothing statement
- donothing donothing donothing donothing in
+ donothing donothing donothing donothing donothing in
let res =
List.sort compare
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 04/24] parsing_cocci: function_prototypes: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (2 preceding siblings ...)
2020-07-16 12:59 ` [Cocci] [PATCH 03/24] parsing_cocci: check_meta: " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 05/24] parsing_cocci: iso_compile: " Jaskaran Singh
` (20 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in function_prototypes.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/function_prototypes.ml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/parsing_cocci/function_prototypes.ml b/parsing_cocci/function_prototypes.ml
index 966369b8..94dd2751 100644
--- a/parsing_cocci/function_prototypes.ml
+++ b/parsing_cocci/function_prototypes.ml
@@ -68,7 +68,7 @@ let drop_positions =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing in
+ donothing donothing donothing donothing in
res.VT0.rebuilder_rec_statement
let get_all_functions rule =
@@ -174,7 +174,7 @@ and strip =
donothing donothing
ident donothing donothing donothing typeC donothing param
donothing donothing donothing donothing donothing donothing donothing
- donothing
+ donothing donothing
and changed_proto = function
(mname,mdef,mproto,None) -> true
@@ -198,7 +198,7 @@ let collect_ident_strings id =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing in
+ donothing donothing donothing donothing in
v.VT0.combiner_rec_ident id
let right_attach_mcode strings (x,ar,info,mc,pos,adj) =
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 05/24] parsing_cocci: iso_compile: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (3 preceding siblings ...)
2020-07-16 12:59 ` [Cocci] [PATCH 04/24] parsing_cocci: function_prototypes: " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 06/24] parsing_cocci: iso_pattern: " Jaskaran Singh
` (19 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in iso_compile.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/iso_compile.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parsing_cocci/iso_compile.ml b/parsing_cocci/iso_compile.ml
index d17e1106..831197d9 100644
--- a/parsing_cocci/iso_compile.ml
+++ b/parsing_cocci/iso_compile.ml
@@ -55,7 +55,7 @@ let sequence_tokens =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing
+ donothing donothing donothing donothing
(* In general, we will get a list of lists:
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 06/24] parsing_cocci: iso_pattern: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (4 preceding siblings ...)
2020-07-16 12:59 ` [Cocci] [PATCH 05/24] parsing_cocci: iso_compile: " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 07/24] parsing_cocci: parse_cocci: " Jaskaran Singh
` (18 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in iso_pattern.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/iso_pattern.ml | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml
index 40fd67e8..5200a4c4 100644
--- a/parsing_cocci/iso_pattern.ml
+++ b/parsing_cocci/iso_pattern.ml
@@ -45,7 +45,7 @@ let strip_info =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing
+ donothing donothing donothing donothing
let anything_equal = function
(Ast0.DotsExprTag(d1),Ast0.DotsExprTag(d2)) ->
@@ -478,7 +478,7 @@ let match_maker checks_needed context_required whencode_allowed =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing
ident expression assignOp binaryOp typeC init param decl field donothing
- stmt donothing donothing donothing donothing in
+ stmt donothing donothing donothing donothing donothing in
let add_pure_list_binding name pure is_pure builder1 builder2 lst =
match (checks_needed,pure) with
@@ -1595,7 +1595,7 @@ let make_minus =
dots dots dots dots dots dots dots dots dots
donothing expression donothing donothing donothing initialiser donothing
declaration field enum_decl statement donothing donothing donothing
- donothing
+ donothing donothing
(* --------------------------------------------------------------------- *)
(* rebuild mcode cells in an instantiated alt *)
@@ -1687,7 +1687,7 @@ let rebuild_mcode start_line =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing statement donothing
- donothing donothing donothing
+ donothing donothing donothing donothing
(* --------------------------------------------------------------------- *)
(* The problem of whencode. If an isomorphism contains dots in multiple
@@ -2172,7 +2172,7 @@ let instantiate bindings mv_bindings model =
(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
+ enumdeclfn stmtfn donothing donothing donothing donothing donothing
(* --------------------------------------------------------------------- *)
@@ -2902,7 +2902,7 @@ let rewrap =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing
+ donothing donothing donothing donothing
let rec rewrap_anything = function
Ast0.DotsExprTag(d) ->
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 07/24] parsing_cocci: parse_cocci: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (5 preceding siblings ...)
2020-07-16 12:59 ` [Cocci] [PATCH 06/24] parsing_cocci: iso_pattern: " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 12:59 ` [Cocci] [PATCH 08/24] parsing_cocci: single_statement: " Jaskaran Singh
` (17 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in parse_cocci.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/parse_cocci.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parsing_cocci/parse_cocci.ml b/parsing_cocci/parse_cocci.ml
index e30039dc..eb88c019 100644
--- a/parsing_cocci/parse_cocci.ml
+++ b/parsing_cocci/parse_cocci.ml
@@ -1966,7 +1966,7 @@ let any_modif rule =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing in
+ donothing donothing donothing donothing in
List.exists fn.VT0.combiner_rec_top_level rule
let eval_virt virt =
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 08/24] parsing_cocci: single_statement: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (6 preceding siblings ...)
2020-07-16 12:59 ` [Cocci] [PATCH 07/24] parsing_cocci: parse_cocci: " Jaskaran Singh
@ 2020-07-16 12:59 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 09/24] parsing_cocci: unitary_ast0: " Jaskaran Singh
` (16 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 12:59 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in single_statement.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/single_statement.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parsing_cocci/single_statement.ml b/parsing_cocci/single_statement.ml
index df50df6a..0b192a94 100644
--- a/parsing_cocci/single_statement.ml
+++ b/parsing_cocci/single_statement.ml
@@ -463,7 +463,7 @@ and contains_only_minus =
dots dots dots dots dots dots dots dots dots
identifier expression donothing donothing typeC donothing donothing
declaration field donothing statement donothing case_line donothing
- donothing
+ donothing donothing
(* needs a special case when there is a Disj or an empty DOTS *)
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 09/24] parsing_cocci: unitary_ast0: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (7 preceding siblings ...)
2020-07-16 12:59 ` [Cocci] [PATCH 08/24] parsing_cocci: single_statement: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 10/24] parsing_cocci: ast0_cocci: Add AttributeTag to SmPL AST0 Jaskaran Singh
` (15 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in unitary_ast0.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/unitary_ast0.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/parsing_cocci/unitary_ast0.ml b/parsing_cocci/unitary_ast0.ml
index f12bef67..fadfa470 100644
--- a/parsing_cocci/unitary_ast0.ml
+++ b/parsing_cocci/unitary_ast0.ml
@@ -207,7 +207,7 @@ let get_free checker t =
donothing donothing
ident expression donothing donothing typeC donothing parameter
declaration field donothing statement donothing case_line donothing
- donothing in
+ donothing 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] 26+ messages in thread
* [Cocci] [PATCH 10/24] parsing_cocci: ast0_cocci: Add AttributeTag to SmPL AST0
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (8 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 09/24] parsing_cocci: unitary_ast0: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 11/24] parsing_cocci: visitor_ast0: Reflect AttributeTag in " Jaskaran Singh
` (14 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
Add the AttributeTag constructor to AST0 of SmPL.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/ast0_cocci.ml | 2 ++
parsing_cocci/ast0_cocci.mli | 1 +
2 files changed, 3 insertions(+)
diff --git a/parsing_cocci/ast0_cocci.ml b/parsing_cocci/ast0_cocci.ml
index bfc0d145..d7d81001 100644
--- a/parsing_cocci/ast0_cocci.ml
+++ b/parsing_cocci/ast0_cocci.ml
@@ -577,6 +577,7 @@ and anything =
| ForInfoTag of forinfo
| CaseLineTag of case_line
| StringFragmentTag of string_fragment
+ | AttributeTag of attr
| TopTag of top_level
| IsoWhenTag of Ast.when_modifier
| IsoWhenTTag of expression
@@ -608,6 +609,7 @@ let stmt x = StmtTag x
let forinfo x = ForInfoTag x
let case_line x = CaseLineTag x
let string_fragment x = StringFragmentTag x
+let attr x = AttributeTag x
let top x = TopTag x
let enum_decl x = EnumDeclTag x
diff --git a/parsing_cocci/ast0_cocci.mli b/parsing_cocci/ast0_cocci.mli
index 20d6e40c..c4b9260b 100644
--- a/parsing_cocci/ast0_cocci.mli
+++ b/parsing_cocci/ast0_cocci.mli
@@ -566,6 +566,7 @@ and anything =
| ForInfoTag of forinfo
| CaseLineTag of case_line
| StringFragmentTag of string_fragment
+ | AttributeTag of attr
| TopTag of top_level
| IsoWhenTag of Ast_cocci.when_modifier (*only for when code, in iso phase*)
| IsoWhenTTag of expression(*only for when code, in iso phase*)
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 11/24] parsing_cocci: visitor_ast0: Reflect AttributeTag in SmPL AST0
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (9 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 10/24] parsing_cocci: ast0_cocci: Add AttributeTag to SmPL AST0 Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 12/24] parsing_cocci: iso_pattern: " Jaskaran Singh
` (13 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to SmPL AST0. Reflect these changes in
visitor_ast0.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/visitor_ast0.ml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml
index 090fe625..e45f9241 100644
--- a/parsing_cocci/visitor_ast0.ml
+++ b/parsing_cocci/visitor_ast0.ml
@@ -1328,6 +1328,9 @@ let visitor mode bind option_default
| Ast0.StringFragmentTag(f) ->
let (f_n,f) = string_fragment f in
(f_n,Ast0.StringFragmentTag(f))
+ | Ast0.AttributeTag(a) ->
+ let (a_n,a) = attribute a in
+ (a_n,Ast0.AttributeTag(a))
| Ast0.TopTag(top) ->
let (top_n,top) = top_level top in
(top_n,Ast0.TopTag(top))
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 12/24] parsing_cocci: iso_pattern: Reflect AttributeTag in SmPL AST0
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (10 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 11/24] parsing_cocci: visitor_ast0: Reflect AttributeTag in " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 13/24] parsing_cocci: unparse_ast0: " Jaskaran Singh
` (12 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to SmPL AST0. Reflect these changes in
iso_pattern.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/iso_pattern.ml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci/iso_pattern.ml
index 5200a4c4..24c2927c 100644
--- a/parsing_cocci/iso_pattern.ml
+++ b/parsing_cocci/iso_pattern.ml
@@ -92,6 +92,9 @@ let anything_equal = function
| (Ast0.StringFragmentTag(d1),Ast0.StringFragmentTag(d2)) ->
(strip_info.VT0.rebuilder_rec_string_fragment d1) =
(strip_info.VT0.rebuilder_rec_string_fragment d2)
+ | (Ast0.AttributeTag(d1),Ast0.AttributeTag(d2)) ->
+ (strip_info.VT0.rebuilder_rec_attribute d1) =
+ (strip_info.VT0.rebuilder_rec_attribute d2)
| (Ast0.TopTag(d1),Ast0.TopTag(d2)) ->
(strip_info.VT0.rebuilder_rec_top_level d1) =
(strip_info.VT0.rebuilder_rec_top_level d2)
@@ -2946,6 +2949,8 @@ let rec rewrap_anything = function
Ast0.CaseLineTag(rewrap.VT0.rebuilder_rec_case_line d)
| Ast0.StringFragmentTag(d) ->
Ast0.StringFragmentTag(rewrap.VT0.rebuilder_rec_string_fragment d)
+ | Ast0.AttributeTag(d) ->
+ Ast0.AttributeTag(rewrap.VT0.rebuilder_rec_attribute d)
| Ast0.TopTag(d) -> Ast0.TopTag(rewrap.VT0.rebuilder_rec_top_level d)
| Ast0.IsoWhenTag(_) | Ast0.IsoWhenTTag(_) | Ast0.IsoWhenFTag(_) ->
failwith "only for isos within iso phase"
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 13/24] parsing_cocci: unparse_ast0: Reflect AttributeTag in SmPL AST0
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (11 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 12/24] parsing_cocci: iso_pattern: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 14/24] parsing_cocci: context_neg: " Jaskaran Singh
` (11 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to SmPL AST0. 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 109f1844..875282fb 100644
--- a/parsing_cocci/unparse_ast0.ml
+++ b/parsing_cocci/unparse_ast0.ml
@@ -873,6 +873,7 @@ let rec unparse_anything x =
| Ast0.ForDecl (_,decl) -> declaration decl)
| Ast0.CaseLineTag(d) -> case_line "" d
| Ast0.StringFragmentTag(d) -> string_fragment d
+ | Ast0.AttributeTag(d) -> print_attribute d
| Ast0.TopTag(d) -> top_level d
| Ast0.IsoWhenTag(x) -> U.print_when_modif x
| Ast0.IsoWhenTTag(e) -> expression e
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 14/24] parsing_cocci: context_neg: Reflect AttributeTag in SmPL AST0
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (12 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 13/24] parsing_cocci: unparse_ast0: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 15/24] parsing_cocci: insert_plus: " Jaskaran Singh
` (10 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to SmPL AST0. Reflect these changes in
context_neg.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/context_neg.ml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/parsing_cocci/context_neg.ml b/parsing_cocci/context_neg.ml
index 6a04f49b..a0d52e9a 100644
--- a/parsing_cocci/context_neg.ml
+++ b/parsing_cocci/context_neg.ml
@@ -46,6 +46,7 @@ let set_mcodekind x mcodekind =
| Ast0.ForInfoTag(d) -> Ast0.set_mcodekind d mcodekind
| Ast0.CaseLineTag(d) -> Ast0.set_mcodekind d mcodekind
| Ast0.StringFragmentTag(d) -> Ast0.set_mcodekind d mcodekind
+ | Ast0.AttributeTag(d) -> Ast0.set_mcodekind d mcodekind
| Ast0.TopTag(d) -> Ast0.set_mcodekind d mcodekind
| Ast0.IsoWhenTag(_) -> failwith "only within iso phase"
| Ast0.IsoWhenTTag(_) -> failwith "only within iso phase"
@@ -81,6 +82,7 @@ let set_index x index =
| Ast0.ForInfoTag(d) -> Ast0.set_index d index
| Ast0.CaseLineTag(d) -> Ast0.set_index d index
| Ast0.StringFragmentTag(d) -> Ast0.set_index d index
+ | Ast0.AttributeTag(d) -> Ast0.set_index d index
| Ast0.TopTag(d) -> Ast0.set_index d index
| Ast0.IsoWhenTag(_) -> failwith "only within iso phase"
| Ast0.IsoWhenTTag(_) -> failwith "only within iso phase"
@@ -115,6 +117,7 @@ let get_index = function
| Ast0.ForInfoTag(d) -> Index.forinfo d
| Ast0.CaseLineTag(d) -> Index.case_line d
| Ast0.StringFragmentTag(d) -> Index.string_fragment d
+ | Ast0.AttributeTag(d) -> Index.attribute d
| Ast0.TopTag(d) -> Index.top_level d
| Ast0.IsoWhenTag(_) -> failwith "only within iso phase"
| Ast0.IsoWhenTTag(_) -> failwith "only within iso phase"
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 15/24] parsing_cocci: insert_plus: Reflect AttributeTag in SmPL AST0
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (13 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 14/24] parsing_cocci: context_neg: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 16/24] parsing_cocci: ast_cocci: Add AttributeTag to the SmPL AST Jaskaran Singh
` (9 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to SmPL AST0. Reflect these changes in
insert_plus.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/ast0toast.mli | 1 +
parsing_cocci/insert_plus.ml | 8 ++++++++
2 files changed, 9 insertions(+)
diff --git a/parsing_cocci/ast0toast.mli b/parsing_cocci/ast0toast.mli
index f4d2bb19..302c2b7d 100644
--- a/parsing_cocci/ast0toast.mli
+++ b/parsing_cocci/ast0toast.mli
@@ -36,6 +36,7 @@ val define_param_dots :
Ast_cocci.define_param Ast_cocci.dots
val case_line : Ast0_cocci.case_line -> Ast_cocci.case_line
val string_fragment : Ast0_cocci.string_fragment -> Ast_cocci.string_fragment
+val attribute : Ast0_cocci.attr -> Ast_cocci.attr
val typeC : bool (*allminus*) -> Ast0_cocci.typeC -> Ast_cocci.fullType
val declaration : Ast0_cocci.declaration -> Ast_cocci.declaration
val field : Ast0_cocci.field -> Ast_cocci.field
diff --git a/parsing_cocci/insert_plus.ml b/parsing_cocci/insert_plus.ml
index 63635b43..6c11a339 100644
--- a/parsing_cocci/insert_plus.ml
+++ b/parsing_cocci/insert_plus.ml
@@ -133,6 +133,7 @@ let create_root_token_table minus =
| Ast0.ForInfoTag(d) -> Ast0.get_index d
| Ast0.CaseLineTag(d) -> Ast0.get_index d
| Ast0.StringFragmentTag(d) -> Ast0.get_index d
+ | Ast0.AttributeTag(d) -> Ast0.get_index d
| Ast0.TopTag(d) -> Ast0.get_index d
| Ast0.IsoWhenTag(_) -> failwith "only within iso phase"
| Ast0.IsoWhenTTag(_) -> failwith "only within iso phase"
@@ -461,6 +462,9 @@ let call_collect_minus context_nodes :
| Ast0.StringFragmentTag(e) ->
(Ast0.get_index e,
(collect_minus_join_points e).VT0.combiner_rec_string_fragment e)
+ | Ast0.AttributeTag(e) ->
+ (Ast0.get_index e,
+ (collect_minus_join_points e).VT0.combiner_rec_attribute e)
| Ast0.CaseLineTag(e) ->
(Ast0.get_index e,
(collect_minus_join_points e).VT0.combiner_rec_case_line e)
@@ -548,6 +552,7 @@ let mk_statement x = Ast.StatementTag (Ast0toast.statement x)
let mk_forinfo x = Ast.ForInfoTag (Ast0toast.forinfo x)
let mk_case_line x = Ast.CaseLineTag (Ast0toast.case_line x)
let mk_string_fragment x = Ast.StringFragmentTag (Ast0toast.string_fragment x)
+let mk_attribute x = Ast.AttributeTag (Ast0toast.attribute x)
let mk_const_vol x = Ast.ConstVolTag x
let mk_token x info = Ast.Token (x,Some info)
let mk_meta (_,x) info = Ast.Token (x,Some info)
@@ -751,6 +756,9 @@ let call_collect_plus context_nodes :
| Ast0.StringFragmentTag(e) ->
(Ast0.get_index e,
(collect_plus_nodes e).VT0.combiner_rec_string_fragment e)
+ | Ast0.AttributeTag(e) ->
+ (Ast0.get_index e,
+ (collect_plus_nodes e).VT0.combiner_rec_attribute e)
| Ast0.TopTag(e) ->
(Ast0.get_index e,
(collect_plus_nodes e).VT0.combiner_rec_top_level e)
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 16/24] parsing_cocci: ast_cocci: Add AttributeTag to the SmPL AST
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (14 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 15/24] parsing_cocci: insert_plus: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 17/24] parsing_cocci: pretty_print_cocci: Reflect AttributeTag in " Jaskaran Singh
` (8 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
Add the AttributeTag constructor to the SmPL AST.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/ast_cocci.ml | 2 ++
parsing_cocci/ast_cocci.mli | 1 +
2 files changed, 3 insertions(+)
diff --git a/parsing_cocci/ast_cocci.ml b/parsing_cocci/ast_cocci.ml
index be6731ab..666629c5 100644
--- a/parsing_cocci/ast_cocci.ml
+++ b/parsing_cocci/ast_cocci.ml
@@ -804,6 +804,7 @@ and anything =
| ForInfoTag of forinfo
| CaseLineTag of case_line
| StringFragmentTag of string_fragment
+ | AttributeTag of attr
| ConstVolTag of const_vol
| Token of string * info option
| Directive of added_string list
@@ -948,6 +949,7 @@ and tag2c = function
| ForInfoTag _ -> "ForInfoTag"
| CaseLineTag _ -> "CaseLineTag"
| StringFragmentTag _ -> "StringFragmentTag"
+ | AttributeTag _ -> "AttributeTag"
| ConstVolTag _ -> "ConstVolTag"
| Token _ -> "Token"
| Directive _ -> "Directive"
diff --git a/parsing_cocci/ast_cocci.mli b/parsing_cocci/ast_cocci.mli
index 6fc961b7..98344912 100644
--- a/parsing_cocci/ast_cocci.mli
+++ b/parsing_cocci/ast_cocci.mli
@@ -773,6 +773,7 @@ and anything =
| ForInfoTag of forinfo
| CaseLineTag of case_line
| StringFragmentTag of string_fragment
+ | AttributeTag of attr
| ConstVolTag of const_vol
| Token of string * info option
| Directive of added_string list
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 17/24] parsing_cocci: pretty_print_cocci: Reflect AttributeTag in SmPL AST
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (15 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 16/24] parsing_cocci: ast_cocci: Add AttributeTag to the SmPL AST Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 18/24] parsing_c: unparse_cocci: " Jaskaran Singh
` (7 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag 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 1ac6d743..095144b1 100644
--- a/parsing_cocci/pretty_print_cocci.ml
+++ b/parsing_cocci/pretty_print_cocci.ml
@@ -1169,6 +1169,7 @@ let _ =
| Ast.ForInfoTag(x) -> forinfo x
| Ast.CaseLineTag(x) -> case_line "" x
| Ast.StringFragmentTag(x) -> string_fragment x
+ | Ast.AttributeTag(x) -> print_attribute x
| Ast.ConstVolTag(x) -> const_vol x
| Ast.Token(x,Some info) -> print_string_befaft print_string x info
| Ast.Token(x,None) -> print_string x
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 18/24] parsing_c: unparse_cocci: Reflect AttributeTag in SmPL AST
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (16 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 17/24] parsing_cocci: pretty_print_cocci: Reflect AttributeTag in " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 19/24] parsing_cocci: visitor_ast: " Jaskaran Singh
` (6 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag 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 | 1 +
1 file changed, 1 insertion(+)
diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml
index 6d437971..e544336d 100644
--- a/parsing_c/unparse_cocci.ml
+++ b/parsing_c/unparse_cocci.ml
@@ -1512,6 +1512,7 @@ let pp_any = function
| Ast.ForInfoTag(x) -> forinfo x; false
| Ast.CaseLineTag(x) -> case_line "" x; false
| Ast.StringFragmentTag(x) -> string_fragment x; false
+ | Ast.AttributeTag(x) -> print_attribute x; false
| Ast.ConstVolTag(x) -> const_vol x unknown unknown; false
| Ast.Directive(xs) ->
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 19/24] parsing_cocci: visitor_ast: Reflect AttributeTag in SmPL AST
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (17 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 18/24] parsing_c: unparse_cocci: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 20/24] parsing_cocci: ast0toast: Reflect AttributeTag in the SmPL ASTs Jaskaran Singh
` (5 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to the SmPL AST. Reflect these changes in
visitor_ast.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/visitor_ast.ml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml
index d5819acf..5288c6f2 100644
--- a/parsing_cocci/visitor_ast.ml
+++ b/parsing_cocci/visitor_ast.ml
@@ -990,6 +990,7 @@ let combiner bind option_default
| Ast.ForInfoTag(rule) -> forinfo rule
| Ast.CaseLineTag(case) -> case_line case
| Ast.StringFragmentTag(frag) -> string_fragment frag
+ | Ast.AttributeTag(attr) -> attribute attr
| Ast.ConstVolTag(cv) -> option_default
| Ast.Token(tok,info) -> option_default
| Ast.Directive(str) -> option_default
@@ -1988,6 +1989,7 @@ let rebuilder
| Ast.CaseLineTag(case) -> Ast.CaseLineTag(case_line case)
| Ast.StringFragmentTag(frag) ->
Ast.StringFragmentTag(string_fragment frag)
+ | Ast.AttributeTag(attr) -> Ast.AttributeTag(attribute attr)
| Ast.ConstVolTag(cv) as x -> x
| Ast.Token(tok,info) as x -> x
| Ast.Directive(str) as 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] 26+ messages in thread
* [Cocci] [PATCH 20/24] parsing_cocci: ast0toast: Reflect AttributeTag in the SmPL ASTs
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (18 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 19/24] parsing_cocci: visitor_ast: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 21/24] ocaml: coccilib: " Jaskaran Singh
` (4 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to the SmPL ASTs. Reflect these changes in
ast0toast.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/ast0toast.ml | 1 +
1 file changed, 1 insertion(+)
diff --git a/parsing_cocci/ast0toast.ml b/parsing_cocci/ast0toast.ml
index 4ccc259b..b4b7600e 100644
--- a/parsing_cocci/ast0toast.ml
+++ b/parsing_cocci/ast0toast.ml
@@ -1264,6 +1264,7 @@ and anything = function
| Ast0.ForInfoTag(d) -> Ast.ForInfoTag(forinfo d)
| Ast0.CaseLineTag(d) -> Ast.CaseLineTag(case_line d)
| Ast0.StringFragmentTag(d) -> Ast.StringFragmentTag(string_fragment d)
+ | Ast0.AttributeTag(d) -> Ast.AttributeTag(attribute d)
| Ast0.TopTag(d) -> Ast.Code(top_level d)
| Ast0.IsoWhenTag(_) -> failwith "not possible"
| Ast0.IsoWhenTTag(_) -> failwith "not possible"
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 21/24] ocaml: coccilib: Reflect AttributeTag in the SmPL ASTs
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (19 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 20/24] parsing_cocci: ast0toast: Reflect AttributeTag in the SmPL ASTs Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 22/24] parsing_cocci: context_neg: Reflect attributefn in AST0 visitor Jaskaran Singh
` (3 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
AttributeTag is added to the SmPL ASTs. Reflect these changes in
coccilib.mli.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
ocaml/coccilib.mli | 2 ++
1 file changed, 2 insertions(+)
diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli
index 010b8aab..19f1512c 100644
--- a/ocaml/coccilib.mli
+++ b/ocaml/coccilib.mli
@@ -3078,6 +3078,7 @@ module Ast_cocci :
| ForInfoTag of forinfo
| CaseLineTag of case_line
| StringFragmentTag of string_fragment
+ | AttributeTag of attr
| ConstVolTag of const_vol
| Token of string * info option
| Directive of added_string list
@@ -3660,6 +3661,7 @@ module Ast0_cocci :
| ForInfoTag of forinfo
| CaseLineTag of case_line
| StringFragmentTag of string_fragment
+ | AttributeTag of attr
| TopTag of top_level
| IsoWhenTag of Ast_cocci.when_modifier
| IsoWhenTTag of expression
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 22/24] parsing_cocci: context_neg: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (20 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 21/24] ocaml: coccilib: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 23/24] parsing_cocci: insert_plus: " Jaskaran Singh
` (2 subsequent siblings)
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in context_neg.ml. Also add a few general fixes w/r/t the usage
of the for_all2 function for comparing attributes.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/ast0_cocci.mli | 1 +
parsing_cocci/context_neg.ml | 20 ++++++++++++++------
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/parsing_cocci/ast0_cocci.mli b/parsing_cocci/ast0_cocci.mli
index c4b9260b..6097039f 100644
--- a/parsing_cocci/ast0_cocci.mli
+++ b/parsing_cocci/ast0_cocci.mli
@@ -599,6 +599,7 @@ val stmt : statement -> anything
val forinfo : forinfo -> anything
val case_line : case_line -> anything
val string_fragment : string_fragment -> anything
+val attr : attr -> anything
val top : top_level -> anything
(* --------------------------------------------------------------------- *)
diff --git a/parsing_cocci/context_neg.ml b/parsing_cocci/context_neg.ml
index a0d52e9a..ebb93806 100644
--- a/parsing_cocci/context_neg.ml
+++ b/parsing_cocci/context_neg.ml
@@ -186,7 +186,7 @@ let collect_plus_lines top =
donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing statement donothing donothing donothing
- donothing in
+ donothing donothing in
fn.VT0.combiner_rec_top_level top
(* --------------------------------------------------------------------- *)
@@ -557,7 +557,7 @@ let classify is_minus all_marked table code =
ident expression (do_nothing Ast0.assignOp) (do_nothing Ast0.binaryOp)
typeC initialiser param declaration field enum_decl
statement (do_nothing Ast0.forinfo) case_line string_fragment
- (do_top Ast0.top) in
+ (do_nothing Ast0.attr) (do_top Ast0.top) in
combiner.VT0.combiner_rec_top_level code
(* --------------------------------------------------------------------- *)
@@ -644,6 +644,7 @@ let rec equal_expression e1 e2 =
equal_mcode ar1 ar2
| (Ast0.Cast(lp1,_,ar1,rp1,_),Ast0.Cast(lp2,_,ar2,rp2,_)) ->
equal_mcode lp1 lp2 &&
+ (List.length ar1) = (List.length ar2) &&
List.for_all2 equal_attribute ar1 ar2 &&
equal_mcode rp1 rp2
| (Ast0.SizeOfExpr(szf1,_),Ast0.SizeOfExpr(szf2,_)) ->
@@ -752,10 +753,14 @@ let equal_declaration d1 d2 =
equal_mcode name1 name2
| (Ast0.Init(stg1,_,_,attr1,eq1,_,sem1),
Ast0.Init(stg2,_,_,attr2,eq2,_,sem2)) ->
- equal_option stg1 stg2 && List.for_all2 equal_attribute attr1 attr2 &&
+ equal_option stg1 stg2 &&
+ (List.length attr1) = (List.length attr2) &&
+ List.for_all2 equal_attribute attr1 attr2 &&
equal_mcode eq1 eq2 && equal_mcode sem1 sem2
| (Ast0.UnInit(stg1,_,_,attr1,sem1),Ast0.UnInit(stg2,_,_,attr2,sem2)) ->
- equal_option stg1 stg2 && List.for_all2 equal_attribute attr1 attr2 &&
+ equal_option stg1 stg2 &&
+ (List.length attr1) = (List.length attr2) &&
+ List.for_all2 equal_attribute attr1 attr2 &&
equal_mcode sem1 sem2
| (Ast0.FunProto(fninfo1,name1,lp1,p1,va1,rp1,sem1),
Ast0.FunProto(fninfo2,name2,lp2,p2,va2,rp2,sem2)) ->
@@ -770,7 +775,9 @@ let equal_declaration d1 d2 =
equal_mcode rp1 rp2 && equal_mcode sem1 sem2
| (Ast0.MacroDecl(stg1,nm1,lp1,_,rp1,attr1,sem1),
Ast0.MacroDecl(stg2,nm2,lp2,_,rp2,attr2,sem2)) ->
- equal_option stg1 stg2 && List.for_all2 equal_attribute attr1 attr2 &&
+ equal_option stg1 stg2 &&
+ (List.length attr1) = (List.length attr2) &&
+ List.for_all2 equal_attribute attr1 attr2 &&
equal_mcode lp1 lp2 && equal_mcode rp1 rp2 && equal_mcode sem1 sem2
| (Ast0.MacroDeclInit(stg1,nm1,lp1,_,rp1,eq1,_,sem1),
Ast0.MacroDeclInit(stg2,nm2,lp2,_,rp2,eq2,_,sem2)) ->
@@ -778,6 +785,7 @@ let equal_declaration d1 d2 =
equal_mcode lp1 lp2 && equal_mcode rp1 rp2 && equal_mcode eq1 eq2
&& equal_mcode sem1 sem2
| (Ast0.TyDecl(_,attr1,sem1),Ast0.TyDecl(_,attr2,sem2)) ->
+ (List.length attr1) = (List.length attr2) &&
List.for_all2 equal_attribute attr1 attr2 && equal_mcode sem1 sem2
| (Ast0.OptDecl(_),Ast0.OptDecl(_)) -> true
| (Ast0.DisjDecl(starter1,_,mids1,ender1),
@@ -1055,7 +1063,7 @@ let contextify_all =
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
donothing donothing donothing donothing donothing donothing donothing
- donothing donothing donothing
+ donothing donothing donothing donothing
let contextify_whencode =
let bind x y = () in
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 23/24] parsing_cocci: insert_plus: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (21 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 22/24] parsing_cocci: context_neg: Reflect attributefn in AST0 visitor Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-16 13:00 ` [Cocci] [PATCH 24/24] tools: spgen: " Jaskaran Singh
2020-07-18 13:59 ` [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL " Julia Lawall
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in insert_plus.ml.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
parsing_cocci/insert_plus.ml | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/parsing_cocci/insert_plus.ml b/parsing_cocci/insert_plus.ml
index 6c11a339..cd45ba8c 100644
--- a/parsing_cocci/insert_plus.ml
+++ b/parsing_cocci/insert_plus.ml
@@ -83,7 +83,8 @@ it *)
(donothing Ast0.param) (donothing Ast0.decl)
(donothing Ast0.field) (donothing Ast0.enum_decl) statement
(donothing Ast0.forinfo) (donothing Ast0.case_line)
- (donothing Ast0.string_fragment) topfn in
+ (donothing Ast0.string_fragment) (donothing Ast0.attr)
+ topfn in
res.VT0.combiner_rec_top_level e
(* --------------------------------------------------------------------- *)
@@ -386,7 +387,7 @@ bind to that; not good for isomorphisms *)
edots idots pdots sdots ddots fdots enumdots cdots dpdots
ident expression do_nothing do_nothing
typeC initialiser param decl field do_nothing statement forinfo
- case_line do_nothing do_top
+ case_line do_nothing do_nothing do_top
let call_collect_minus context_nodes :
@@ -678,7 +679,8 @@ let collect_plus_nodes root =
(do_nothing mk_declaration) (do_nothing mk_field)
(do_nothing mk_enum_decl)
stmt (do_nothing mk_forinfo) (do_nothing mk_case_line)
- (do_nothing mk_string_fragment) toplevel
+ (do_nothing mk_string_fragment) (do_nothing mk_attribute)
+ toplevel
let call_collect_plus context_nodes :
(int * (Ast0.info * Ast.count * Ast.anything) list) list =
@@ -1239,7 +1241,7 @@ let reevaluate_contextness =
donothing donothing donothing donothing donothing donothing stmt
donothing
donothing donothing
- donothing in
+ donothing donothing in
res.VT0.combiner_rec_top_level
(* --------------------------------------------------------------------- *)
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Cocci] [PATCH 24/24] tools: spgen: Reflect attributefn in AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (22 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 23/24] parsing_cocci: insert_plus: " Jaskaran Singh
@ 2020-07-16 13:00 ` Jaskaran Singh
2020-07-18 13:59 ` [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL " Julia Lawall
24 siblings, 0 replies; 26+ messages in thread
From: Jaskaran Singh @ 2020-07-16 13:00 UTC (permalink / raw)
To: cocci
The SmPL AST0 visitor has a function for attributes. Reflect these
changes in spgen.
Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
tools/spgen/source/detect_patch.ml | 3 ++-
tools/spgen/source/meta_variable.ml | 3 ++-
tools/spgen/source/rule_body.ml | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/tools/spgen/source/detect_patch.ml b/tools/spgen/source/detect_patch.ml
index 0489afec..7b148a23 100644
--- a/tools/spgen/source/detect_patch.ml
+++ b/tools/spgen/source/detect_patch.ml
@@ -111,6 +111,7 @@ let patch_combiner =
let paramfn = donothing in
let forinfofn = donothing in
let string_fragmentfn = donothing in
+ let attributefn = donothing in
let topfn = donothing in
let dotsstmtfn = donothing in
@@ -163,7 +164,7 @@ let patch_combiner =
dotsexprfn dotsinitfn dotsparamfn dotsstmtfn dotsdeclfn dotsfieldfn
dotsenumdeclfn dotscasefn dotsdefparfn
identfn exprfn assignOpfn binaryOpfn tyfn initfn paramfn declfn fieldfn
- enumdeclfn stmtfn forinfofn casefn string_fragmentfn topfn
+ enumdeclfn stmtfn forinfofn casefn string_fragmentfn attributefn topfn
(* ------------------------------------------------------------------------- *)
diff --git a/tools/spgen/source/meta_variable.ml b/tools/spgen/source/meta_variable.ml
index 31456614..40dcae9c 100644
--- a/tools/spgen/source/meta_variable.ml
+++ b/tools/spgen/source/meta_variable.ml
@@ -396,6 +396,7 @@ 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 --- *)
@@ -577,7 +578,7 @@ let metavar_combiner rn =
dotsexprfn dotsinitfn dotsparamfn dotsstmtfn dotsdeclfn dotsfieldfn
dotsenumdeclfn dotscasefn dotsdefparfn
identfn exprfn assignOpfn binaryOpfn tyfn initfn paramfn declfn fieldfn
- enumdeclfn stmtfn forinfofn casefn string_fragmentfn topfn
+ enumdeclfn stmtfn forinfofn casefn string_fragmentfn attributefn topfn
(* ------------------------------------------------------------------------- *)
diff --git a/tools/spgen/source/rule_body.ml b/tools/spgen/source/rule_body.ml
index 163dff9a..d8aa957e 100644
--- a/tools/spgen/source/rule_body.ml
+++ b/tools/spgen/source/rule_body.ml
@@ -231,6 +231,7 @@ let rec gen_combiner ~context_mode =
let forinfofn = donothing in
let casefn = donothing in
let string_fragmentfn = donothing in
+ let attributefn = donothing in
(* Universal special cases, regardless of no_gen mode:
* Disjunctions with SmPL style pattern-matching may need to be split into
@@ -353,7 +354,7 @@ let rec gen_combiner ~context_mode =
dotsexprfn dotsinitfn dotsparamfn dotsstmtfn dotsdeclfn dotsfieldfn
dotsenumdeclfn dotscasefn dotsdefparfn
identfn exprfn assignOpfn binaryOpfn tyfn initfn paramfn declfn fieldfn
- enumdeclfn stmtfn forinfofn casefn string_fragmentfn topfn
+ enumdeclfn stmtfn forinfofn casefn string_fragmentfn attributefn topfn
(* ------------------------------------------------------------------------- *)
--
2.21.3
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor
2020-07-16 12:59 [Cocci] [PATCH 00/24] parsing_cocci: Add attributefn to the SmPL AST0 visitor Jaskaran Singh
` (23 preceding siblings ...)
2020-07-16 13:00 ` [Cocci] [PATCH 24/24] tools: spgen: " Jaskaran Singh
@ 2020-07-18 13:59 ` Julia Lawall
24 siblings, 0 replies; 26+ messages in thread
From: Julia Lawall @ 2020-07-18 13:59 UTC (permalink / raw)
To: Jaskaran Singh; +Cc: cocci
On Thu, 16 Jul 2020, Jaskaran Singh wrote:
> This patch series aims to add a public function for visiting attributes
> to the SmPL AST0 visitor. This is needed to support meta attributes. An
> AttributeTag constructor is also added due to dependencies, as well as
> to maintain consistency with the codebase.
Applied.
>
> Jaskaran Singh (24):
> parsing_cocci: visitor_ast0: Add attributefn to SmPL AST0 visitor
> parsing_cocci: ast0toast: Reflect attributefn in AST0 visitor
> parsing_cocci: check_meta: Reflect attributefn in AST0 visitor
> parsing_cocci: function_prototypes: Reflect attributefn in AST0 visitor
> parsing_cocci: iso_compile: Reflect attributefn in AST0 visitor
> parsing_cocci: iso_pattern: Reflect attributefn in AST0 visitor
> parsing_cocci: parse_cocci: Reflect attributefn in AST0 visitor
> parsing_cocci: single_statement: Reflect attributefn in AST0 visitor
> parsing_cocci: unitary_ast0: Reflect attributefn in AST0 visitor
> parsing_cocci: ast0_cocci: Add AttributeTag to SmPL AST0
> parsing_cocci: visitor_ast0: Reflect AttributeTag in SmPL AST0
> parsing_cocci: iso_pattern: Reflect AttributeTag in SmPL AST0
> parsing_cocci: unparse_ast0: Reflect AttributeTag in SmPL AST0
> parsing_cocci: context_neg: Reflect AttributeTag in SmPL AST0
> parsing_cocci: insert_plus: Reflect AttributeTag in SmPL AST0
> parsing_cocci: ast_cocci: Add AttributeTag to the SmPL AST
> parsing_cocci: pretty_print_cocci: Reflect AttributeTag in SmPL AST
> parsing_c: unparse_cocci: Reflect AttributeTag in SmPL AST
> parsing_cocci: visitor_ast: Reflect AttributeTag in SmPL AST
> parsing_cocci: ast0toast: Reflect AttributeTag in the SmPL ASTs
> ocaml: coccilib: Reflect AttributeTag in the SmPL ASTs
> parsing_cocci: context_neg: Reflect attributefn in AST0 visitor
> parsing_cocci: insert_plus: Reflect attributefn in AST0 visitor
> tools: spgen: Reflect attributefn in AST0 visitor
>
> ocaml/coccilib.mli | 2 ++
> parsing_c/unparse_cocci.ml | 1 +
> parsing_cocci/ast0_cocci.ml | 2 ++
> parsing_cocci/ast0_cocci.mli | 2 ++
> parsing_cocci/ast0toast.ml | 5 +++--
> parsing_cocci/ast0toast.mli | 1 +
> parsing_cocci/ast_cocci.ml | 2 ++
> parsing_cocci/ast_cocci.mli | 1 +
> parsing_cocci/check_meta.ml | 4 ++--
> parsing_cocci/context_neg.ml | 23 +++++++++++++++++------
> parsing_cocci/function_prototypes.ml | 6 +++---
> parsing_cocci/insert_plus.ml | 18 ++++++++++++++----
> parsing_cocci/iso_compile.ml | 2 +-
> parsing_cocci/iso_pattern.ml | 17 +++++++++++------
> parsing_cocci/parse_cocci.ml | 2 +-
> parsing_cocci/pretty_print_cocci.ml | 1 +
> parsing_cocci/single_statement.ml | 2 +-
> parsing_cocci/unitary_ast0.ml | 2 +-
> parsing_cocci/unparse_ast0.ml | 1 +
> parsing_cocci/visitor_ast.ml | 2 ++
> parsing_cocci/visitor_ast0.ml | 24 ++++++++++++++++++++----
> parsing_cocci/visitor_ast0.mli | 2 ++
> parsing_cocci/visitor_ast0_types.ml | 6 ++++++
> parsing_cocci/visitor_ast0_types.mli | 6 ++++++
> tools/spgen/source/detect_patch.ml | 3 ++-
> tools/spgen/source/meta_variable.ml | 3 ++-
> tools/spgen/source/rule_body.ml | 3 ++-
> 27 files changed, 109 insertions(+), 34 deletions(-)
>
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 26+ messages in thread