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 >

Re: [Cocci] [PATCH 05/26] parsing_cocci: visitor_ast0: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
On Mon, 2020-03-16 at 20:10 +0100, Markus Elfring wrote: > > The order of the terms in ParenType require implementing a special > > case for ParenType. This case handles only the following: > … > > It seems that this change description was repeated in other update > steps. Whoops, dumb mistake.

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

Re: [Cocci] [PATCH 05/26] parsing_cocci: visitor_ast0: Add cases for ParenType/FunctionType

2020-03-16 Thread Markus Elfring
> The order of the terms in ParenType require implementing a special > case for ParenType. This case handles only the following: … It seems that this change description was repeated in other update steps. Does this detail indicate a need to reconsider the patch granularity? Regards, Markus

Re: [Cocci] [PATCH 02/26] parsing_cocci: AST: Add ParenType and FunctionType to SmPL ASTs

2020-03-16 Thread Markus Elfring
> ParenType and FunctionType are types present in the C AST that > are not present in the SmPL AST. Will a bit more background information become helpful for these data types? Regards, Markus ___ Cocci mailing list Cocci@systeme.lip6.fr

Re: [Cocci] [PATCH 01/26] parsing_cocci: Add Function Prototype token

2020-03-16 Thread Markus Elfring
> Thus, a slightly hacky approach is taken to determine a function > prototype with not the best certainty but what works for most cases > in SmPL. If the identifier is preceded by any token that does not > seem to be part of a type, then it is not identified as a function > prototype. Else, it

Re: [Cocci] [PATCH 00/26] cocci: Add ParenType/FunctionType to SmPL ASTs

2020-03-16 Thread Markus Elfring
> The aim of this patch series is to add the types ParenType Can it be that this kind of data processing will need a bit more explanation? > The FunctionPointer type is removed from the SmPL AST, since > all the productions that produce FunctionPointers in the SmPL > parser are replaced by

[Cocci] [PATCH 26/26] tests: Add test case for array of function pointers

2020-03-16 Thread Jaskaran Singh
Add a test case to match against an array of function pointers. This would previously not work due to differences in the C and SmPL ASTs. Signed-off-by: Jaskaran Singh --- tests/funptr_array.c | 1 + tests/funptr_array.cocci | 9 + tests/funptr_array.res | 1 + 3 files changed, 11

[Cocci] [PATCH 23/26] engine: Match A.ParenType and A.FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are added to the SmPL AST as types. Match these types correctly. Signed-off-by: Jaskaran Singh --- engine/check_exhaustive_pattern.ml | 2 ++ engine/cocci_vs_c.ml | 27 +++ 2 files changed, 29 insertions(+) diff --git

[Cocci] [PATCH 24/26] tools: spgen: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in position_generator.ml. Signed-off-by: Jaskaran Singh --- tools/spgen/source/position_generator.ml | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tools/spgen/source/position_generator.ml

[Cocci] [PATCH 25/26] cocci: Remove Ast_cocci.FunctionPointer

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now in the SmPL AST, and these types have replaced all productions related to the FunctionPointer type in the SmPL parser. Remove FunctionPointer from the SmPL ASTs, its cases and any functions or constructs related to it from the codebase. Signed-off-by: Jaskaran

[Cocci] [PATCH 20/26] parsing_cocci: ast_cocci: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in ast_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast_cocci.ml | 10 ++ 1 file changed, 10 insertions(+) diff --git a/parsing_cocci/ast_cocci.ml b/parsing_cocci/ast_cocci.ml index

[Cocci] [PATCH 14/26] parsing_cocci: adjust_pragmas: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in adjust_pragmas.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/adjust_pragmas.ml | 4 1 file changed, 4 insertions(+) diff --git a/parsing_cocci/adjust_pragmas.ml b/parsing_cocci/adjust_pragmas.ml

[Cocci] [PATCH 13/26] parsing_cocci: iso_pattern: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in iso_pattern.ml. Signed-off-by: Jaskaran Singh --- 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

[Cocci] [PATCH 12/26] parsing_cocci: check_meta: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in check_meta.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/check_meta.ml | 5 + 1 file changed, 5 insertions(+) diff --git a/parsing_cocci/check_meta.ml b/parsing_cocci/check_meta.ml index

[Cocci] [PATCH 22/26] parsing_c: unparse_cocci: Print ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
The order of the terms in ParenType require implementing a special case for ParenType. This case handles only the following: ( * id [ .* ] ) ( params ) i.e., a function pointer or an array of function pointers, and will fail for any other cases. This is similar to the function used to

[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

[Cocci] [PATCH 08/26] parsing_cocci: context_neg: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in context_neg.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/context_neg.ml | 4 1 file changed, 4 insertions(+) diff --git a/parsing_cocci/context_neg.ml b/parsing_cocci/context_neg.ml index

[Cocci] [PATCH 18/26] parsing_cocci: unify_ast: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in unify_ast.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unify_ast.ml | 8 1 file changed, 8 insertions(+) diff --git a/parsing_cocci/unify_ast.ml b/parsing_cocci/unify_ast.ml index

[Cocci] [PATCH 10/26] parsing_cocci: single_statement: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType/FunctionType are now types in the SmPL ASTs. Add cases for these types in single_statement.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/single_statement.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_cocci/single_statement.ml

[Cocci] [PATCH 15/26] parsing_cocci: compute_lines: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in compute_lines.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/compute_lines.ml | 11 +++ 1 file changed, 11 insertions(+) diff --git a/parsing_cocci/compute_lines.ml

[Cocci] [PATCH 11/26] parsing_cocci: function_prototypes: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in function_prototypes.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/function_prototypes.ml | 4 1 file changed, 4 insertions(+) diff --git a/parsing_cocci/function_prototypes.ml

[Cocci] [PATCH 17/26] parsing_cocci: type_cocci: Add ParenType/FunctionType to types

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in type_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/type_cocci.mli | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_cocci/type_cocci.mli b/parsing_cocci/type_cocci.mli index

[Cocci] [PATCH 21/26] parsing_cocci: pretty_print_cocci: Print ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
The order of the terms in ParenType require implementing a special case for ParenType. This case handles only the following: ( * id [ .* ] ) ( params ) i.e., a function pointer or an array of function pointers, and will fail for any other cases. This is similar to the function used to

[Cocci] [PATCH 09/26] parsing_cocci: unparse_ast0: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType/FunctionType are now types in the SmPL ASTs. Add cases for these types in unparse_ast0.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unparse_ast0.ml | 43 +++ 1 file changed, 43 insertions(+) diff --git a/parsing_cocci/unparse_ast0.ml

[Cocci] [PATCH 19/26] parsing_cocci: disjdistr: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in disjdistr.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/disjdistr.ml | 10 ++ 1 file changed, 10 insertions(+) diff --git a/parsing_cocci/disjdistr.ml b/parsing_cocci/disjdistr.ml index

[Cocci] [PATCH 03/26] parsing_cocci: parser: Add direct_declarator/direct_abstract_d rules

2020-03-16 Thread Jaskaran Singh
The direct_declarator rule and the direct_abstract_d rule are present in the C parser. Add similar rules to the SmPL parser so that declarators are parsed as they are in the C parser. For the type ParenType, direct_declarator and direct_abstract_d only allow the following productions: (

[Cocci] [PATCH 02/26] parsing_cocci: AST: Add ParenType and FunctionType to SmPL ASTs

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are types present in the C AST that are not present in the SmPL AST. In the pursuit of aligning both the C and SmPL ASTs, add these types to the SmPL ASTs. Signed-off-by: Jaskaran Singh --- ocaml/coccilib.mli | 6 ++ parsing_cocci/ast0_cocci.ml | 3 +++

[Cocci] [PATCH 05/26] parsing_cocci: visitor_ast0: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
The order of the terms in ParenType require implementing a special case for ParenType. This case handles only the following: ( * id [ .* ] ) ( params ) i.e., a function pointer or an array of function pointers, and will fail for any other cases. This is similar to the function used to

[Cocci] [PATCH 07/26] parsing_cocci: index: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
ParenType and FunctionType are now added to the SmPL ASTs. Add cases for these types in index.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/index.ml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/parsing_cocci/index.ml b/parsing_cocci/index.ml index a1103503..5c91f620 100644 ---

[Cocci] [PATCH 01/26] parsing_cocci: Add Function Prototype token

2020-03-16 Thread Jaskaran Singh
To add the types ParenType and FunctionType to the SmPL AST, a reduce/reduce conflict with the funproto rule of the SmPL parser must be resolved. This requires explicitly identifying a function prototype by use of a token (TFunProto). While the correct method of identifying a function prototype

[Cocci] [PATCH 00/26] cocci: Add ParenType/FunctionType to SmPL ASTs

2020-03-16 Thread Jaskaran Singh
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

[Cocci] [PATCH 04/26] parsing_cocci: visitor_ast0: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
The order of the terms in ParenType require implementing a special case for ParenType. This case handles only the following: ( * id [ .* ] ) ( params ) i.e., a function pointer or an array of function pointers, and will fail for any other cases. This is similar to the function used to