Re: [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
On Mon, 2020-03-16 at 20:20 +0100, Markus Elfring wrote:
> > ParenType and FunctionType are added to the SmPL ASTs.
> > Add cases for these types in ….ml.
> 
> A change description template was used several times.
> I wonder if there is really a need to modify only a single OCaml
> source file
> in these update steps.
> How do you think about to combine such changes in a bigger update
> step?
> 

These are separated this way so that it's easier for Julia to review.
She will probably just squash all 26 of these together and apply them
later.

Cheers,
Jaskaran.

> Regards,
> Markus

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


Re: [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType

2020-03-16 Thread Markus Elfring
> ParenType and FunctionType are added to the SmPL ASTs.
> Add cases for these types in ….ml.

A change description template was used several times.
I wonder if there is really a need to modify only a single OCaml source file
in these update steps.
How do you think about to combine such changes in a bigger update step?

Regards,
Markus
___
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci


[Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are added to the SmPL ASTs. Add
cases for these types in arity.ml.

Signed-off-by: Jaskaran Singh 
---
 parsing_cocci/arity.ml | 17 +
 1 file changed, 17 insertions(+)

diff --git a/parsing_cocci/arity.ml b/parsing_cocci/arity.ml
index f29b86eb..3b408554 100644
--- a/parsing_cocci/arity.ml
+++ b/parsing_cocci/arity.ml
@@ -419,6 +419,23 @@ and top_typeC tgt opt_allowed typ =
   let params = parameter_list tgt params in
   make_typeC typ tgt arity
(Ast0.FunctionPointer(ty,lp1,star,rp1,lp2,params,rp2))
+  | Ast0.ParenType(lp,ty,rp) ->
+  let arity =
+all_same opt_allowed tgt (mcode2line lp)
+[mcode2arity lp; mcode2arity rp] in
+  let lp = mcode lp in
+  let ty = typeC arity ty in
+  let rp = mcode rp in
+  make_typeC typ tgt arity (Ast0.ParenType(lp,ty,rp))
+  | Ast0.FunctionType(ty,lp,params,rp) ->
+  let arity =
+all_same opt_allowed tgt (mcode2line lp)
+[mcode2arity lp; mcode2arity rp] in
+  let ty = typeC arity ty in
+  let lp = mcode lp in
+  let params = parameter_list tgt params in
+  let rp = mcode rp in
+  make_typeC typ tgt arity (Ast0.FunctionType(ty,lp,params,rp))
   | Ast0.Array(ty,lb,size,rb) ->
   let arity =
all_same opt_allowed tgt (mcode2line lb)
-- 
2.21.1

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