[Cocci] [PATCH] parsing_c: handle space and ctx newline around minus toks

2019-11-19 Thread Jaskaran Singh
, the space next to the right paranthesis should be dropped: if(a) -{ -result = b; goto c; -} Signed-off-by: Jaskaran Singh --- parsing_c/unparse_c.ml | 33 - 1 file changed, 20 insertions(+), 13 deletions(-) diff --git

[Cocci] [PATCH 2/2] tests: Add test case for statement removed and added

2019-11-27 Thread Jaskaran Singh
This is in response to the following "continue statement of death" report: https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06199.html Coccinelle would crash in similar cases, so add a test case for it. Signed-off-by: Jaskaran Singh --- tests/stmt_removed_and_added

[Cocci] [PATCH 1/2] engine: remove circular references in MINUS/NOREPLACEMENT case

2019-11-27 Thread Jaskaran Singh
The cocci info tag can sometimes have circular references in the MINUS/NOREPLACEMENT case in the transformation. Pass the binding info through clean_env to remove circular references. Signed-off-by: Jaskaran Singh --- engine/transformation_c.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion

[Cocci] [PATCH 0/2] cocci: Fix continue statement of death and similar cases

2019-11-27 Thread Jaskaran Singh
The following patch series is for fixing the "continue statement of death" report here: https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06199.html Changes include removing circular references that cause the crash and adding a corresponding test case. engine/transformation_c.ml |

[Cocci] [PATCH v3 3/3] tests: Add test case to match const pointer variants

2020-02-09 Thread Jaskaran Singh
Pointer to const pointer and its variants would not match previously. Add a test case for matching these types. Signed-off-by: Jaskaran Singh --- tests/constptr.c | 7 +++ tests/constptr.cocci | 19 +++ tests/constptr.res | 7 +++ 3 files changed, 33 insertions

[Cocci] [PATCH v3 1/3] parsing_c: Align C AST and Cocci AST for pointer

2020-02-09 Thread Jaskaran Singh
ci AST constructed would be: Pointer2 -> const Pointer1 -> char Change the pointer rule in the C parser so that an AST similar to the Cocci AST is constructed. Make necessary changes in the C pretty printer so that the pointer type is printed correctly. Signed-off-by: Jaskaran Singh --- parsing_c/

[Cocci] [PATCH v3 2/3] tests: Add space between * and const in ptrconstptr.res

2020-02-09 Thread Jaskaran Singh
A space is now added between the * and qualifier. Reflect this change in the ptrconstptr test case. Signed-off-by: Jaskaran Singh --- tests/ptrconstptr.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ptrconstptr.res b/tests/ptrconstptr.res index f5b2210c..1d0c3c1d

[Cocci] [PATCH v3 0/3] cocci: Align the C AST and Cocci AST for pointer

2020-02-09 Thread Jaskaran Singh
This series is to address the type matching problem in Coccinelle. Patch 1/3 is for aligning the C and Cocci AST so that pointer to const pointer and its variants can be matched. Patch 2/3 reflects the pretty printing changes made in 1/3 in the ptrconstptr test case. A space is added between

Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs

2020-01-20 Thread Jaskaran Singh
On Tue, 2020-01-21 at 06:20 +, Julia Lawall wrote: > > On Sun, 19 Jan 2020, Jaskaran Singh wrote: > > > bool is widely used in the Linux kernel. Certain cases of > > parsing_hacks.ml would mislabel bool. > > > > Add bool to the list of known typedefs. >

Re: [Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs

2020-01-20 Thread Jaskaran Singh
On Tue, 2020-01-21 at 06:23 +, Julia Lawall wrote: > > On Sun, 19 Jan 2020, Jaskaran Singh wrote: > > > bool is widely used in the Linux kernel. Certain cases of > > parsing_hacks.ml would mislabel bool. > > > > Add bool to the list of known typedefs. >

[Cocci] [PATCH v2 2/3] parsing_hacks: Add bool to list of known typedefs

2020-01-21 Thread Jaskaran Singh
Before: passed:bool passed:bool passed:bool passed:bool passed:bool After: passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline Signed-off-by: Jaskaran Singh --- par

[Cocci] [PATCH v2 1/3] parsing_c: Handle case of macro before typedef

2020-01-21 Thread Jaskaran Singh
: nb good = 18956150, nb passed = 134061 => 0.70% passed After: nb good = 18956150, nb passed = 134062 => 0.70% passed Signed-off-by: Jaskaran Singh --- parsing_c/parsing_hacks.ml | 35 +++ 1 file changed, 35 insertions(+) diff

[Cocci] [PATCH v2 3/3] tests: Add test case for bool

2020-01-21 Thread Jaskaran Singh
This would previously yield pretty printing errors, i.e. bool would be printed on the next line, followed by ret on the next to next line. The metatype should be only bool and not bool. Signed-off-by: Jaskaran Singh --- tests/macro_before_bool.c | 4 tests/macro_before_bool.cocci | 9

[Cocci] [PATCH v2 0/3] cocci: Improve management of macros before typedefs

2020-01-21 Thread Jaskaran Singh
This patch series is for improving the management of the following case: If is a known typedef (such as u8 or *_t) then label as a CppMacro. Subsequent cases will label correctly as a typedef ident. Also add bool to the list of known typedefs so that cases of bool are handled

Re: [Cocci] [PATCH v2 2/3] parsing_hacks: Add bool to list of known typedefs

2020-01-21 Thread Jaskaran Singh
On Tue, 2020-01-21 at 11:10 +0100, Markus Elfring wrote: > > Before: > > passed:bool > > I wonder if subsequent duplicate information can really help to > achieve a better understanding > by the suggested description of a software situation. > Hm, I thought it would but you're probably right.

[Cocci] [PATCH v3 0/3] cocci: Improve management of macros before typedefs

2020-01-21 Thread Jaskaran Singh
This patch series is for improving the management of the following case: If is a known typedef (such as u8 or *_t) then label as a CppMacro. Subsequent cases will continue to label correctly as a typedef identifier. Also add bool to the list of known typedefs so that cases of bool are

[Cocci] [PATCH v3 3/3] tests: Add test case for bool

2020-01-21 Thread Jaskaran Singh
This would previously yield pretty printing errors, i.e. bool would be printed on the next line, followed by ret on the next to next line. The metatype should be only bool and not bool. Signed-off-by: Jaskaran Singh --- tests/macro_before_bool.c | 4 tests/macro_before_bool.cocci

[Cocci] [PATCH v3 2/3] parsing_hacks: Add bool to list of known typedefs

2020-01-21 Thread Jaskaran Singh
Before: passed:bool passed:bool passed:bool passed:bool passed:bool After: passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline passed:nokprobe_inline Signed-off-by: Jaskaran Singh --- par

[Cocci] [PATCH v3 1/3] parsing_c: Handle case of macro before typedef

2020-01-21 Thread Jaskaran Singh
on the Linux Kernel v5.5-rc4: Before: nb good = 18956150, nb passed = 134061 => 0.70% passed After: nb good = 18956150, nb passed = 134062 => 0.70% passed Signed-off-by: Jaskaran Singh --- parsing_c/parsing_hacks.ml | 35 +++ 1 file chang

Re: [Cocci] [PATCH 2/2] tests: Add test case for matching pointers to const pointers (and variants)

2020-02-06 Thread Jaskaran Singh
On Wed, 2020-02-05 at 19:55 +0100, Markus Elfring wrote: > Would you like to avoid any abbreviations in the patch subject? > I used abbreviations to keep the patch subject short but still clear. Would the following be a better subject? "tests: Add test case to match const pointer variants"

Re: [Cocci] [PATCH 1/2] parsing_c: Align C AST and Cocci AST for pointers

2020-02-06 Thread Jaskaran Singh
On Wed, 2020-02-05 at 19:36 +0100, Markus Elfring wrote: > … > > +++ b/parsing_c/pretty_print_c.ml > > @@ -804,11 +804,12 @@ and pp_string_format (e,ii) = > > (FunctionType (return=void, params=int i) *) > >(*WRONG I THINK, use left & right function *) > >(*

[Cocci] [PATCH v2 2/2] tests: Add test case to match const pointer variants

2020-02-06 Thread Jaskaran Singh
Pointer to const pointer and its variants would not match previously. Add a test case for matching these types. Signed-off-by: Jaskaran Singh --- tests/constptr.c | 7 +++ tests/constptr.cocci | 19 +++ tests/constptr.res | 7 +++ 3 files changed, 33 insertions

[Cocci] [PATCH v2 0/2] cocci: Align the C AST and Cocci AST for pointer

2020-02-06 Thread Jaskaran Singh
This series is to address the type matching problem in Coccinelle. Patch 1/2 is for aligning the C and Cocci AST so that pointer to const pointer and its variants can be matched. Patch 2/2 consists of a test case for matching a pointer to const pointer and its variants. Changes in v2:

[Cocci] [PATCH v2 1/2] parsing_c: Align C AST and Cocci AST for pointer

2020-02-06 Thread Jaskaran Singh
ci AST constructed would be: Pointer2 -> const Pointer1 -> char Change the pointer rule in the C parser so that an AST similar to the Cocci AST is constructed. Make necessary changes in the C pretty printer so that the pointer type is printed correctly. Signed-off-by: Jaskaran Singh --- parsing_c/

Re: [Cocci] [2/2] tests: Add test case to match const pointer variants

2020-02-06 Thread Jaskaran Singh
On Fri, 2020-02-07 at 07:07 +0100, Markus Elfring wrote: > > Would the following be a better subject? > > The alternative is nicer. > > > Will other implementation details become also more interesting? > > The information “Align C AST and Cocci AST” was provided. >

Re: [Cocci] [PATCH 1/2] parsing_c: Align C AST and Cocci AST for const pointer variants

2020-02-08 Thread Jaskaran Singh
On Sat, 2020-02-08 at 09:30 +0100, Markus Elfring wrote: > > For a pointer, the C parser constructed an AST dissimilar from that > > of the Cocci AST. This caused failures in matching with certain > > pointer types. For example, for the following case: > > > > char *1 const *2 id; > > > > The C

[Cocci] [PATCH 0/2] cocci: Align the C AST and Cocci AST for pointer

2020-02-05 Thread Jaskaran Singh
This series is to address the type matching problem in Coccinelle. Patch 1/2 is for aligning the C and Cocci AST so that pointer to const pointer and its variants can be matched. Patch 2/2 consists of a test case for matching a pointer to const pointer and its variants. parsing_c/parser_c.mly

[Cocci] [PATCH 2/2] tests: Add test case for matching ptr to const ptr and variants

2020-02-05 Thread Jaskaran Singh
These types would not match previously. Add a test case for matching a pointer to a const pointer and its variants. Signed-off-by: Jaskaran Singh --- tests/constptr.c | 7 +++ tests/constptr.cocci | 19 +++ tests/constptr.res | 7 +++ 3 files changed, 33

[Cocci] [PATCH 1/2] parsing_c: Align C AST and Cocci AST for pointer

2020-02-05 Thread Jaskaran Singh
ci AST constructed would be: Pointer2 -> const Pointer1 -> char Change the pointer rule in the C parser so that an AST similar to the Cocci AST is constructed. Make necessary changes in the C pretty printer so that the pointer type is printed correctly. Signed-off-by: Jaskaran Singh --- parsing_c/

Re: [Cocci] [PATCH v4 3/3] tests: Add test case to match const pointer variants

2020-02-09 Thread Jaskaran Singh
On Sun, 2020-02-09 at 17:48 +0100, Julia Lawall wrote: > On Sun, 9 Feb 2020, Jaskaran Singh wrote: > > > Pointer to const pointer and its variants would not match > > previously. > > Add a test case for matching these types. > > > > Signed-off-by: Jaskaran

[Cocci] [PATCH v4 0/3] cocci: Align the C AST and Cocci AST for pointer

2020-02-09 Thread Jaskaran Singh
This series is to address the type matching problem in Coccinelle. Patch 1/3 is for aligning the C and Cocci AST so that pointer to const pointer and its variants can be matched. Patch 2/3 reflects the pretty printing changes made in 1/3 in the ptrconstptr test case. A space is added between

[Cocci] [PATCH v4 2/3] tests: Add space between * and const in ptrconstptr.res

2020-02-09 Thread Jaskaran Singh
A space is now added between the * and qualifier. Reflect this change in the ptrconstptr test case. Signed-off-by: Jaskaran Singh --- tests/ptrconstptr.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ptrconstptr.res b/tests/ptrconstptr.res index f5b2210c..1d0c3c1d

[Cocci] [PATCH v4 3/3] tests: Add test case to match const pointer variants

2020-02-09 Thread Jaskaran Singh
Pointer to const pointer and its variants would not match previously. Add a test case for matching these types. Signed-off-by: Jaskaran Singh --- tests/constptr.c | 7 +++ tests/constptr.cocci | 19 +++ tests/constptr.res | 7 +++ 3 files changed, 33 insertions

[Cocci] [PATCH v4 1/3] parsing_c: Align C AST and Cocci AST for pointer

2020-02-09 Thread Jaskaran Singh
ci AST constructed would be: Pointer2 -> const Pointer1 -> char Change the pointer rule in the C parser so that an AST similar to the Cocci AST is constructed. Make necessary changes in the C pretty printer so that the pointer type is printed correctly. Signed-off-by: Jaskaran Singh --- parsing_c/

[Cocci] [PATCH v5 1/3] parsing_c: Align C AST and Cocci AST for pointer

2020-02-11 Thread Jaskaran Singh
ci AST constructed would be: Pointer2 -> const Pointer1 -> char Change the pointer rule in the C parser so that an AST similar to the Cocci AST is constructed. Make necessary changes in the C pretty printer so that the pointer type is printed correctly. Signed-off-by: Jaskaran Singh --- parsing_c/

[Cocci] [PATCH v5 3/3] tests: Add test case to match const pointer variants

2020-02-11 Thread Jaskaran Singh
Pointer to const pointer and its variants would not match previously. Add a test case for matching these types. Signed-off-by: Jaskaran Singh --- tests/constptr.c | 7 +++ tests/constptr.cocci | 19 +++ tests/constptr.res | 7 +++ 3 files changed, 33 insertions

[Cocci] [PATCH v5 2/3] tests: Add space between * and const in ptrconstptr.res

2020-02-11 Thread Jaskaran Singh
A space is now added between the * and qualifier. Reflect this change in the ptrconstptr test case. Signed-off-by: Jaskaran Singh --- tests/ptrconstptr.res | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ptrconstptr.res b/tests/ptrconstptr.res index f5b2210c..1d0c3c1d

[Cocci] [PATCH v5 0/3] cocci: Align the C AST and Cocci AST for pointer

2020-02-11 Thread Jaskaran Singh
This series is to address the type matching problem in Coccinelle. Patch 1/3 is for aligning the C and Cocci AST so that pointer to const pointer and its variants can be matched. Patch 2/3 reflects the pretty printing changes made in 1/3 in the ptrconstptr test case. A space is added between

[Cocci] [PATCH] parsing_c: Add space for tokens after *

2020-01-15 Thread Jaskaran Singh
In certain cases, there is no space added after the Pointer type. Examples of such cases are * const, * __attr and * const *. In the Pointer case of pp_type_with_ident_rest and pp_type_left, if the * is followed by anything within the type, add a space after the printing. Signed-off-by: Jaskaran

[Cocci] [PATCH] parsing_c: Handle case of macro before typedef

2020-01-19 Thread Jaskaran Singh
good = 18956150, nb passed = 134061 => 0.70% passed --- nb good = 18956150, nb passed = 134062 => 0.70% passed Signed-off-by: Jaskaran Singh --- parsing_c/parsing_hacks.ml | 33 + 1 file changed, 33 insertions(+) diff --git a/par

Re: [Cocci] [PATCH] parsing_c: Handle case of macro before typedef

2020-01-19 Thread Jaskaran Singh
On Sun, 2020-01-19 at 18:48 +0530, Jaskaran Singh wrote: > For the following case: > > > > A case in parsing_hacks.ml sometimes mislabels as a > typedef ident. > > If is a known typedef (such as u8 or *_t), then label > as a CppMacro. Subsequent cases w

[Cocci] [PATCH] parsing_c: Handle case of macro before typedef

2020-01-19 Thread Jaskaran Singh
: nb good = 18956150, nb passed = 134061 => 0.70% passed After: nb good = 18956150, nb passed = 134062 => 0.70% passed Signed-off-by: Jaskaran Singh --- parsing_c/parsing_hacks.ml | 35 +++ 1 file changed, 35 insertions(+) diff

[Cocci] [PATCH] parsing_hacks: Add bool to list of known typedefs

2020-01-19 Thread Jaskaran Singh
150, nb passed = 134073 => 0.70% passed Signed-off-by: Jaskaran Singh --- The above diff has been obtained after applying https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06706.html parsing_c/parsing_hacks.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/par

[Cocci] [PATCH 0/2] cocci: Add space for tokens after *

2020-01-16 Thread Jaskaran Singh
The Pointer cases in pp_type_with_ident_rest and pp_type_left of pretty_print_c.ml sometimes do not add a necessary space, if there exist tokens after the *. Create changes necessary for adding this space and add a test case for * const *. parsing_c/pretty_print_c.ml |4

[Cocci] [PATCH 1/2] parsing_c: Add space for tokens after *

2020-01-16 Thread Jaskaran Singh
In certain cases, there is no space added after the Pointer type. Examples of such cases are * const, * __attr and * const *. In the Pointer case of pp_type_with_ident_rest and pp_type_left, if the * is followed by anything within the type, add a space after the printing. Signed-off-by: Jaskaran

[Cocci] [PATCH 2/2] tests: Add test case for * const *

2020-01-16 Thread Jaskaran Singh
Previously, a space would not be added after the * const. Add a test case for testing spacing with use of the type. Signed-off-by: Jaskaran Singh --- tests/ptrconstptr.c | 3 +++ tests/ptrconstptr.cocci | 7 +++ tests/ptrconstptr.res | 3 +++ 3 files changed, 13 insertions(+) create

Re: [Cocci] [PATCH] parsing_c: Add space for tokens after *

2020-01-16 Thread Jaskaran Singh
On Thu, 2020-01-16 at 17:01 +0530, Jaskaran Singh wrote: > On Thu, 2020-01-16 at 11:59 +0100, Julia Lawall wrote: > > On Thu, 16 Jan 2020, Jaskaran Singh wrote: > > > > > On Thu, 2020-01-16 at 11:40 +0100, Markus Elfring wrote: > > > > > In certain cases, th

Re: [Cocci] [PATCH] parsing_c: Add space for tokens after *

2020-01-16 Thread Jaskaran Singh
On Thu, 2020-01-16 at 11:59 +0100, Julia Lawall wrote: > > On Thu, 16 Jan 2020, Jaskaran Singh wrote: > > > On Thu, 2020-01-16 at 11:40 +0100, Markus Elfring wrote: > > > > In certain cases, there is no space added after the Pointer > > > > type. > >

[Cocci] [PATCH] parsing_c: Handle case of annotation in function proto/def

2020-01-08 Thread Jaskaran Singh
For the following case: [const_vol] [ptr] The lookahead function in Parsing_hacks would mislabel as a CppDirective, causing pretty printing errors. Add a case in the lookahead function for handling this case. Signed-off-by: Jaskaran Singh --- parsing_c/parsing_hacks.ml | 14

[Cocci] [PATCH 2/2] tests: Add test case for user comments attached to ident

2020-01-10 Thread Jaskaran Singh
When comments were appended to an identifier passed from python to cocci or ocaml to cocci, two cases showed pretty printing errors. Add a test case for both of the erroneous cases. Signed-off-by: Jaskaran Singh --- tests/id_comments.c | 4 tests/id_comments.cocci | 19

[Cocci] [PATCH 1/2] parsing_c: Support user comments attached to identifier

2020-01-10 Thread Jaskaran Singh
to pretty printing errors. The reason for this is that cases in unparse_cocci.ml do not recognize the identifier and the comments as different tokens. Add a function to support user comments. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_cocci.ml | 32 +--- 1 file

[Cocci] [PATCH 0/2] cocci: Support user comments attached to identifiers

2020-01-10 Thread Jaskaran Singh
Comments attached to identifiers via OCaml/Python bindings can be helpful in using Coccinelle for source code analysis. Users of SmPL can attach these comments to identifiers for denoting some information. This patch series is for handling these comments and adding a corresponding test case for

[Cocci] [PATCH] parsing_c: Handle case of annotation and ; or = after ident

2020-01-08 Thread Jaskaran Singh
For the following case: [const_vol] [ptr] The lookahead function in Parsing_hacks would mislabel as a CppDirective. Add cases in the lookahead function for handling this case. Signed-off-by: Jaskaran Singh --- parsing_c/parsing_hacks.ml | 31 +++ 1 file

Re: [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum

2020-03-09 Thread Jaskaran Singh
On Mon, 2020-03-09 at 15:15 +0100, Julia Lawall wrote: > > On Sun, 8 Mar 2020, Jaskaran Singh wrote: > > > The C AST and SmPL AST differs with respect to the enum type. > > > > For an enumerator, the C AST is as follows: > > Enum -> list of (name, (info

[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 04/26] parsing_cocci: visitor_ast0: Add cases for ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
to print ParenType in Pretty_print_c. Signed-off-by: Jaskaran Singh --- parsing_cocci/visitor_ast0.ml | 163 ++ 1 file changed, 163 insertions(+) diff --git a/parsing_cocci/visitor_ast0.ml b/parsing_cocci/visitor_ast0.ml index c282e1f8..c56cd7a7 100644

[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 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 c1ccb58f

[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 03/26] parsing_cocci: parser: Add direct_declarator/direct_abstract_d rules

2020-03-16 Thread Jaskaran Singh
parser with the above mentioned rules. All usages of d_ident, however, have not been removed due to reduce/reduce conflicts. Remove rules/productions that parse function pointers with usage of direct_declarator and direct_abstract_d. Signed-off-by: Jaskaran Singh --- parsing_cocci

[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 01/26] parsing_cocci: Add Function Prototype token

2020-03-16 Thread Jaskaran Singh
-by: Jaskaran Singh --- parsing_cocci/parse_cocci.ml | 72 +++ parsing_cocci/parser_cocci_menhir.mly | 9 ++-- 2 files changed, 67 insertions(+), 14 deletions(-) diff --git a/parsing_cocci/parse_cocci.ml b/parsing_cocci/parse_cocci.ml index 679d213a..4b2cb7e4 100644

[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 b/parsing_cocci

[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 02b0fd9c

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

2020-03-16 Thread Jaskaran Singh
to print ParenType in Pretty_print_c. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_cocci.ml | 60 ++ 1 file changed, 60 insertions(+) diff --git a/parsing_c/unparse_cocci.ml b/parsing_c/unparse_cocci.ml index 30e755e9..9dd84821 100644 --- a/parsing_c

[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 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 b/parsing_cocci

[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 b/parsing_cocci

[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 21/26] parsing_cocci: pretty_print_cocci: Print ParenType/FunctionType

2020-03-16 Thread Jaskaran Singh
to print ParenType in Pretty_print_c. Signed-off-by: Jaskaran Singh --- parsing_cocci/pretty_print_cocci.ml | 57 + 1 file changed, 57 insertions(+) diff --git a/parsing_cocci/pretty_print_cocci.ml b/parsing_cocci/pretty_print_cocci.ml index 6338e464..ef60106c 100644

[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 b

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

2020-03-16 Thread Jaskaran Singh
to print ParenType in Pretty_print_c. Signed-off-by: Jaskaran Singh --- parsing_cocci/visitor_ast.ml | 75 1 file changed, 75 insertions(+) diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci/visitor_ast.ml index 3d5de794..99af7652 100644

[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 d4ad3030

[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 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 a/engine

[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 b/tools

Re: [Cocci] [PATCH 22/23] tests: Add test case for removing parameter attributes

2020-04-28 Thread Jaskaran Singh
On Mon, 2020-04-27 at 19:31 +0200, Julia Lawall wrote: > > On Mon, 27 Apr 2020, Jaskaran Singh wrote: > > > Add a test case for removing Parameter attributes. The test case > > checks > > correct removal of the attribute when it is: > > > > - before the pa

Re: [Cocci] [RFC PATCH 00/25] cocci: Improve C parsing of attributes

2020-04-25 Thread Jaskaran Singh
On Fri, 2020-04-24 at 14:02 +0200, Markus Elfring wrote: > > This patch series aims to improve parsing of attributes in C by > > Coccinelle's C parser. > > How do you think about to use the wording “in C source code by”? > > > > These parsing errors were discovered by running a build of > >

[Cocci] [PATCH 13/23] parsing_c: unparse_cocci: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Print these attributes correctly in unparse_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_cocci.ml | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/parsing_c/unparse_cocci.ml b/parsing_c

[Cocci] [PATCH 14/23] parsing_cocci: ast_cocci: Add Parameter attributes

2020-04-27 Thread Jaskaran Singh
Add parameter attributes to the SmPL AST. This is a list of attributes in the VoidParam and Param types of the SmPL AST. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast_cocci.ml | 4 ++-- parsing_cocci/ast_cocci.mli | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git

[Cocci] [PATCH 15/23] parsing_cocci: visitor_ast: Visit Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Visit these attributes in the AST visitor. Signed-off-by: Jaskaran Singh --- parsing_cocci/visitor_ast.ml | 22 +- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/parsing_cocci/visitor_ast.ml b/parsing_cocci

[Cocci] [PATCH 10/23] parsing_cocci: iso_pattern: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in iso_pattern.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/iso_pattern.ml | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/parsing_cocci/iso_pattern.ml b/parsing_cocci

[Cocci] [PATCH 16/23] parsing_cocci: ast0toast: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in ast0toast.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast0toast.ml | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/parsing_cocci/ast0toast.ml b/parsing_cocci/ast0toast.ml index 09c28c06

[Cocci] [PATCH 23/23] tests: Add test case to detect parameter attributes

2020-04-27 Thread Jaskaran Singh
identifier. Signed-off-by: Jaskaran Singh --- tests/detect_param_attr.c | 3 +++ tests/detect_param_attr.cocci | 13 + tests/detect_param_attr.res | 3 +++ 3 files changed, 19 insertions(+) create mode 100644 tests/detect_param_attr.c create mode 100644 tests

[Cocci] [PATCH 12/23] parsing_cocci: unparse_ast0: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in unparse_ast0.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unparse_ast0.ml | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/parsing_cocci/unparse_ast0.ml b/parsing_cocci

[Cocci] [PATCH 06/23] parsing_cocci: compute_lines: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in compute_lines.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/compute_lines.ml | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/parsing_cocci/compute_lines.ml b/parsing_cocci

[Cocci] [PATCH 00/23] cocci: Add parameter attributes to SmPL

2020-04-27 Thread Jaskaran Singh
to detect a parameter attribute. - remove_param_attr: Test case to remove a parameter attribute as per the given SmPL. [1]https://www.mail-archive.com/cocci@systeme.lip6.fr/msg07133.html Jaskaran Singh (23): parsing_cocci: ast0_cocci: Add parameter attributes parsing_cocci: par

[Cocci] [PATCH 05/23] parsing_cocci: check_meta: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in check_meta.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/check_meta.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsing_cocci/check_meta.ml b/parsing_cocci/check_meta.ml index 5a348ba3

[Cocci] [PATCH 09/23] parsing_cocci: index: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in index.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/index.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parsing_cocci/index.ml b/parsing_cocci/index.ml index f7ae48b4..1baeb2bb 100644

[Cocci] [PATCH 02/23] parsing_cocci: parser: Parse Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Parse these attributes correctly in the SmPL parser. The added production only supports attributes after the type or the type and identifier. Signed-off-by: Jaskaran Singh --- parsing_cocci/parser_cocci_menhir.mly | 7 --- 1 file changed, 4

[Cocci] [PATCH 08/23] parsing_cocci: function_prototypes: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in function_prototypes.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/function_prototypes.ml | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parsing_cocci/function_prototypes.ml b

[Cocci] [PATCH 21/23] ocaml: coccilib: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in coccilib.mli. Signed-off-by: Jaskaran Singh --- ocaml/coccilib.mli | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli index 0e807c9a..59c58aea 100644

[Cocci] [PATCH 20/23] engine: cocci_vs_c: Match Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the C and SmPL AST. Match the attributes correctly in cocci_vs_c.ml. Signed-off-by: Jaskaran Singh --- engine/cocci_vs_c.ml | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/engine/cocci_vs_c.ml b/engine/cocci_vs_c.ml index

[Cocci] [PATCH 18/23] parsing_cocci: pretty_print_cocci: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Print these attributes correctly in pretty_print_cocci.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/pretty_print_cocci.ml | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/parsing_cocci

[Cocci] [PATCH 19/23] parsing_cocci: unify_ast: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in unify_ast.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/unify_ast.ml | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/parsing_cocci/unify_ast.ml b/parsing_cocci/unify_ast.ml index

[Cocci] [PATCH 11/23] parsing_cocci: type_infer: Reflect Parameter attributes

2020-04-27 Thread Jaskaran Singh
Parameter attributes are added to the SmPL AST. Reflect these changes in type_infer.ml. Signed-off-by: Jaskaran Singh --- parsing_cocci/type_infer.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parsing_cocci/type_infer.ml b/parsing_cocci/type_infer.ml index e8aad810

  1   2   3   4   5   6   >