* Re: [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType
@ 2020-03-16 19:20 Markus Elfring
2020-03-17 5:28 ` Jaskaran Singh
0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2020-03-16 19:20 UTC (permalink / raw)
To: Jaskaran Singh, cocci; +Cc: linux-kernel-mentees
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType
2020-03-16 19:20 [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType Markus Elfring
@ 2020-03-17 5:28 ` Jaskaran Singh
2020-03-17 8:40 ` [Cocci] [06/26] " Markus Elfring
0 siblings, 1 reply; 6+ messages in thread
From: Jaskaran Singh @ 2020-03-17 5:28 UTC (permalink / raw)
To: Markus Elfring; +Cc: linux-kernel-mentees, cocci
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
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Cocci] [06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType
2020-03-17 5:28 ` Jaskaran Singh
@ 2020-03-17 8:40 ` Markus Elfring
2020-03-17 8:53 ` Julia Lawall
0 siblings, 1 reply; 6+ messages in thread
From: Markus Elfring @ 2020-03-17 8:40 UTC (permalink / raw)
To: Jaskaran Singh, cocci; +Cc: linux-kernel-mentees
>> 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.
I suggest to reconsider such an approach.
> She will probably just squash all 26 of these together and apply them later.
I got special views also around patch squashing.
Would you like to reduce the number of update steps
according to the really desired software transformation?
Regards,
Markus
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Cocci] [06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType
2020-03-17 8:40 ` [Cocci] [06/26] " Markus Elfring
@ 2020-03-17 8:53 ` Julia Lawall
2020-03-17 8:57 ` Markus Elfring
0 siblings, 1 reply; 6+ messages in thread
From: Julia Lawall @ 2020-03-17 8:53 UTC (permalink / raw)
To: Markus Elfring; +Cc: linux-kernel-mentees, cocci
On Tue, 17 Mar 2020, Markus Elfring wrote:
> >> 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.
>
> I suggest to reconsider such an approach.
>
>
> > She will probably just squash all 26 of these together and apply them later.
>
> I got special views also around patch squashing.
> Would you like to reduce the number of update steps
> according to the really desired software transformation?
I asked him to cut it up into small chunks.
julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] [PATCH 00/26] cocci: Add ParenType/FunctionType to SmPL ASTs
@ 2020-03-16 10:02 Jaskaran Singh
2020-03-16 10:02 ` [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType Jaskaran Singh
0 siblings, 1 reply; 6+ messages in thread
From: Jaskaran Singh @ 2020-03-16 10:02 UTC (permalink / raw)
To: cocci; +Cc: linux-kernel-mentees
The aim of this patch series is to add the types ParenType
and FunctionType to the SmPL AST. These types are present in
the C AST but not in the SmPL AST.
Preliminarily, a hack to resolve a reduce/reduce conflict
with the funproto rule in the SmPL parser is implemented.
Upon this, rules similar to that of the C parser's direct
declarator and abstract direct declarator rules are implemented,
and used wherever suitable. These rules produce ParenType and
FunctionType, similar to the C parser.
Cases for these types are added to various places in the codebase.
The FunctionPointer type is removed from the SmPL AST, since
all the productions that produce FunctionPointers in the SmPL
parser are replaced by those that produce ParenType. Any functions,
constructs or cases of FunctionPointer are also removed from the
codebase.
A test case to match an array of function pointers is included to
demonstrate matching improvements.
[PATCH 01/26] parsing_cocci: Add Function Prototype token
[PATCH 02/26] parsing_cocci: AST: Add ParenType and FunctionType to
[PATCH 03/26] parsing_cocci: parser: Add
[PATCH 04/26] parsing_cocci: visitor_ast0: Add cases for
[PATCH 05/26] parsing_cocci: visitor_ast0: Add cases for
[PATCH 06/26] parsing_cocci: arity: Add cases for
[PATCH 07/26] parsing_cocci: index: Add cases for
[PATCH 08/26] parsing_cocci: context_neg: Add cases for
[PATCH 09/26] parsing_cocci: unparse_ast0: Add cases for
[PATCH 10/26] parsing_cocci: single_statement: Add cases for
[PATCH 11/26] parsing_cocci: function_prototypes: Add cases for
[PATCH 12/26] parsing_cocci: check_meta: Add cases for
[PATCH 13/26] parsing_cocci: iso_pattern: Add cases for
[PATCH 14/26] parsing_cocci: adjust_pragmas: Add cases for
[PATCH 15/26] parsing_cocci: compute_lines: Add cases for
[PATCH 16/26] parsing_cocci: ast0toast: Add cases for
[PATCH 17/26] parsing_cocci: type_cocci: Add ParenType/FunctionType
[PATCH 18/26] parsing_cocci: unify_ast: Add cases for
[PATCH 19/26] parsing_cocci: disjdistr: Add cases for
[PATCH 20/26] parsing_cocci: ast_cocci: Add cases for
[PATCH 21/26] parsing_cocci: pretty_print_cocci: Print
[PATCH 22/26] parsing_c: unparse_cocci: Print ParenType/FunctionType
[PATCH 23/26] engine: Match A.ParenType and A.FunctionType
[PATCH 24/26] tools: spgen: Add cases for ParenType/FunctionType
[PATCH 25/26] cocci: Remove Ast_cocci.FunctionPointer
[PATCH 26/26] tests: Add test case for array of function pointers
engine/check_exhaustive_pattern.ml | 3
engine/cocci_vs_c.ml | 82 +++-------
ocaml/coccilib.mli | 10 -
parsing_c/unparse_cocci.ml | 74 +++++++--
parsing_cocci/adjust_pragmas.ml | 7
parsing_cocci/arity.ml | 25 ++-
parsing_cocci/ast0_cocci.ml | 7
parsing_cocci/ast0_cocci.mli | 6
parsing_cocci/ast0toast.ml | 11 -
parsing_cocci/ast_cocci.ml | 21 +-
parsing_cocci/ast_cocci.mli | 6
parsing_cocci/check_meta.ml | 8 -
parsing_cocci/compute_lines.ml | 21 +-
parsing_cocci/context_neg.ml | 4
parsing_cocci/disjdistr.ml | 16 +-
parsing_cocci/function_prototypes.ml | 7
parsing_cocci/get_constants.ml | 2
parsing_cocci/index.ml | 3
parsing_cocci/iso_pattern.ml | 17 --
parsing_cocci/parse_cocci.ml | 72 +++++++--
parsing_cocci/parser_cocci_menhir.mly | 248 +++++++++++++++----------------
parsing_cocci/pretty_print_cocci.ml | 71 +++++++-
parsing_cocci/single_statement.ml | 3
parsing_cocci/type_cocci.mli | 3
parsing_cocci/type_infer.ml | 25 +--
parsing_cocci/unify_ast.ml | 16 +-
parsing_cocci/unparse_ast0.ml | 56 +++++--
parsing_cocci/visitor_ast.ml | 101 +++++++++---
parsing_cocci/visitor_ast0.ml | 214 ++++++++++++++++++++------
tests/funptr_array.c | 1
tests/funptr_array.cocci | 9 +
tests/funptr_array.res | 1
tools/spgen/source/meta_variable.ml | 1
tools/spgen/source/position_generator.ml | 9 -
34 files changed, 754 insertions(+), 406 deletions(-)
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType
2020-03-16 10:02 [Cocci] [PATCH 00/26] cocci: Add ParenType/FunctionType to SmPL ASTs Jaskaran Singh
@ 2020-03-16 10:02 ` Jaskaran Singh
0 siblings, 0 replies; 6+ messages in thread
From: Jaskaran Singh @ 2020-03-16 10:02 UTC (permalink / raw)
To: cocci; +Cc: linux-kernel-mentees
ParenType and FunctionType are added to the SmPL ASTs. Add
cases for these types in arity.ml.
Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-03-17 8:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-16 19:20 [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType Markus Elfring
2020-03-17 5:28 ` Jaskaran Singh
2020-03-17 8:40 ` [Cocci] [06/26] " Markus Elfring
2020-03-17 8:53 ` Julia Lawall
2020-03-17 8:57 ` Markus Elfring
-- strict thread matches above, loose matches on Subject: below --
2020-03-16 10:02 [Cocci] [PATCH 00/26] cocci: Add ParenType/FunctionType to SmPL ASTs Jaskaran Singh
2020-03-16 10:02 ` [Cocci] [PATCH 06/26] parsing_cocci: arity: Add cases for ParenType/FunctionType 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).