Re: [Cocci] Checking two error messages

2020-03-08 Thread Julia Lawall
On Sun, 8 Mar 2020, Markus Elfring wrote: > Hello, > > I have tried the following small script variant out again for > the semantic patch language. > > @display@ > expression action; > expression* pointer, target, x; > identifier member, var; > statement is; > type t; > @@ > ( > *t* var =

[Cocci] Checking two error messages

2020-03-08 Thread Markus Elfring
Hello, I have tried the following small script variant out again for the semantic patch language. @display@ expression action; expression* pointer, target, x; identifier member, var; statement is; type t; @@ ( *t* var = pointer->member; | *pointer->member; | *target = pointer->member; | *t* var

[Cocci] [PATCH 13/13] tools: spgen: Reflect visitor changes

2020-03-08 Thread Jaskaran Singh
Visitor_ast0 has changes with respect to enums. Reflect these changes in spgen by adding additional arguments in the combiners and rebuilders. Signed-off-by: Jaskaran Singh --- tools/spgen/source/detect_patch.ml | 6 -- tools/spgen/source/meta_variable.ml | 6 --

[Cocci] [PATCH 11/13] cocci: pretty print EnumDef as per enum_decl type

2020-03-08 Thread Jaskaran Singh
The SmPL AST has a separate enum_decl for a enumerator. Make corresponding changes in Unparse_cocci and Pretty_print_cocci to correctly pretty print enumerators. Signed-off-by: Jaskaran Singh --- parsing_c/unparse_cocci.ml | 27 ---

[Cocci] [PATCH 12/13] tests: Add test case for assigned enumerator

2020-03-08 Thread Jaskaran Singh
Add a test case to verify correct pretty printing of enumerators that are assigned. The test case should cover minused assigned enumerators, plussed assigned enumerators and correct matching of an enum with an assigned enumerator. Signed-off-by: Jaskaran Singh --- tests/enum_assign.c | 6

[Cocci] [PATCH 07/13] parsing_cocci: Reflect visitor_ast0 changes in parsing_cocci

2020-03-08 Thread Jaskaran Singh
The SmPL AST0 visitor has functions for handling enumerators separately. Handle these collateral evolutions in parsing_cocci by creating visitor functions for enum and enumdots in various places, as well as adding the additional arguments needed in the visitor combiners and rebuilders.

[Cocci] [PATCH 10/13] engine: cocci_vs_c: Match enumerators properly as per enum_decl

2020-03-08 Thread Jaskaran Singh
The SmPL AST has a separate enum_decl type for an enumerator. Make corresponding changes in Cocci_vs_c to correctly match enumerators. Signed-off-by: Jaskaran Singh --- engine/cocci_vs_c.ml | 44 ++-- 1 file changed, 18 insertions(+), 26 deletions(-)

[Cocci] [PATCH 09/13] cocci: Reflect changes in SmPL visitor_ast in codebase

2020-03-08 Thread Jaskaran Singh
The SmPL AST visitor has functions for handling enumerators separately. Handle these collateral evolutions in the codebase by creating visitor functions for enum and enumdots in various places, as well as adding the additional arguments needed in the visitor combiners and rebuilders.

[Cocci] [PATCH 08/13] parsing_cocci: Add visitor functions for enum_decl in visitor_ast

2020-03-08 Thread Jaskaran Singh
An enumerator in the SmPL AST now has the enum_decl type. Add corresponding functions for the combiner, combiner_rebuilder and rebuilder in Visitor_ast. Signed-off-by: Jaskaran Singh n --- parsing_cocci/visitor_ast.ml | 72 +++ parsing_cocci/visitor_ast.mli | 8

[Cocci] [PATCH 02/13] ocaml: coccilib: Reflect changes in SmPL AST for EnumDef

2020-03-08 Thread Jaskaran Singh
The EnumDef constructor is changed in the SmPL AST. Reflect these changes in coccilib. Signed-off-by: Jaskaran Singh --- ocaml/coccilib.mli | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli index 5a913099..9b00e130

[Cocci] [PATCH 03/13] parsing_cocci: parser: Parse enumerators correctly

2020-03-08 Thread Jaskaran Singh
The EnumDef constructor of the SmPL AST has changed. Make the SmPL parser parse an EnumDef correctly. Signed-off-by: Jaskaran Singh --- parsing_cocci/parse_aux.ml| 5 + parsing_cocci/parse_aux.mli | 9 + parsing_cocci/parser_cocci_menhir.mly | 13

[Cocci] [PATCH 04/13] parsing_cocci: Add EnumDeclTag and EnumDeclDotsTag to SmPL ASTs

2020-03-08 Thread Jaskaran Singh
These constructors are needed by the visitor and various other functions in the codebase. Maintain consistency and add these constructs w/r/t changes in the SmPL AST. Signed-off-by: Jaskaran Singh --- parsing_cocci/ast0_cocci.ml | 4 parsing_cocci/ast0_cocci.mli | 4

[Cocci] [PATCH 06/13] parsing_cocci: visitor_ast0: Add visitor functions for enum_decl

2020-03-08 Thread Jaskaran Singh
An enumerator in the SmPL AST now has the enum_decl type. Add corresponding functions for the combiner, combiner_rebuilder and rebuilder in Visitor_ast0. Signed-off-by: Jaskaran Singh --- parsing_cocci/visitor_ast0.ml| 72 ++-- parsing_cocci/visitor_ast0.mli

[Cocci] [PATCH 01/13] parsing_cocci: Align C AST and SmPL AST for enum

2020-03-08 Thread Jaskaran Singh
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, expression)) For the same, the SmPL AST is as follows: EnumDef -> list of expression While the SmPL parser does make sure that enumerators are

[Cocci] [PATCH 05/13] ocaml: coccilib: Reflect EnumDeclTag and EnumDeclDotsTag

2020-03-08 Thread Jaskaran Singh
The SmPL AST now has these constructors. Reflect these changes in coccilib. Signed-off-by: Jaskaran Singh --- ocaml/coccilib.mli | 5 + 1 file changed, 5 insertions(+) diff --git a/ocaml/coccilib.mli b/ocaml/coccilib.mli index 9b00e130..d01d2a93 100644 --- a/ocaml/coccilib.mli +++

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

2020-03-08 Thread Jaskaran Singh
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, expression)) For the same, the SmPL AST is as follows: EnumDef -> list of expression While the SmPL parser does make sure that enumerators