Coccinelle archive on lore.kernel.org
 help / color / Atom feed
* Re: [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum
@ 2020-03-09  9:55 Markus Elfring
  0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2020-03-09  9:55 UTC (permalink / raw)
  To: Jaskaran Singh, cocci; +Cc: linux-kernel-mentees

> The C AST and SmPL AST differs with respect to the enum type.

I suggest to consider wording variants.

“The … and … differ ….”


> collateral evolutions caused by changed in the SmPL visitors are

“… by changes in …”

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum
  2020-03-09 14:15 ` Julia Lawall
@ 2020-03-09 14:51   ` Jaskaran Singh
  0 siblings, 0 replies; 4+ messages in thread
From: Jaskaran Singh @ 2020-03-09 14:51 UTC (permalink / raw)
  To: Julia Lawall; +Cc: linux-kernel-mentees, cocci

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, expression))
> > 
> > For the same, the SmPL AST is as follows:
> >     EnumDef -> list of expression
> > 
> > While the SmPL parser does make sure that enumerators are
> > parsed as per C rules, the OCaml types for an enumerator themselves
> > mismatch, due to their organization. This causes bugs/mismatches
> > for
> > cases where enums are in disjunctions.
> > 
> > This patch series makes the enumerator type of the SmPL AST
> > closer to that of the C AST. Various places in the codebase that
> > handle an enum are also changed to match the new type, and
> > collateral evolutions caused by changed in the SmPL visitors are
> > handled as well.
> > 
> > Changes are also made to Cocci_vs_c to correctly match two
> > enumerators, and in Pretty_print_cocci and Unparse_cocci to
> > correctly print an enumerator.
> 
> I have applied all of the changes.  In the end, I squashed all of the
> commits together, to only commit something that compiles, but I
> appreciated having the changes broken up into more understandable
> units.
> 

Sorry about that. Will be more careful about these big changes next
time, and thanks for applying.

Cheers,
Jaskaran.

> thanks,
> julia
> 
> 
> > [PATCH 01/13] parsing_cocci: Align C AST and SmPL AST for enum
> > [PATCH 02/13] ocaml: coccilib: Reflect changes in SmPL AST for
> > [PATCH 03/13] parsing_cocci: parser: Parse enumerators correctly
> > [PATCH 04/13] parsing_cocci: Add EnumDeclTag and EnumDeclDotsTag to
> > [PATCH 05/13] ocaml: coccilib: Reflect EnumDeclTag and
> > [PATCH 06/13] parsing_cocci: visitor_ast0: Add visitor functions
> > for
> > [PATCH 07/13] parsing_cocci: Reflect visitor_ast0 changes in
> > [PATCH 08/13] parsing_cocci: Add visitor functions for enum_decl in
> > [PATCH 09/13] cocci: Reflect changes in SmPL visitor_ast in
> > codebase
> > [PATCH 10/13] engine: cocci_vs_c: Match enumerators properly as per
> > [PATCH 11/13] cocci: pretty print EnumDef as per enum_decl type
> > [PATCH 12/13] tests: Add test case for assigned enumerator
> > [PATCH 13/13] tools: spgen: Reflect visitor changes
> > 
> >  cocci.ml                              |    4 -
> >  engine/asttoctl2.ml                   |   21 +++++---
> >  engine/asttomember.ml                 |   17 ++++---
> >  engine/cocci_vs_c.ml                  |   46 ++++++++-----------
> >  engine/transformation_c.ml            |    4 -
> >  ocaml/coccilib.mli                    |   22 ++++++++-
> >  parsing_c/unparse_cocci.ml            |   27 ++++++++++-
> >  parsing_c/unparse_hrule.ml            |    4 -
> >  parsing_cocci/arity.ml                |   25 ++++++++++
> >  parsing_cocci/ast0_cocci.ml           |   15 +++++-
> >  parsing_cocci/ast0_cocci.mli          |   14 +++++
> >  parsing_cocci/ast0toast.ml            |   30 +++++++++++-
> >  parsing_cocci/ast0toast.mli           |    4 +
> >  parsing_cocci/ast_cocci.ml            |   13 +++++
> >  parsing_cocci/ast_cocci.mli           |   12 ++++-
> >  parsing_cocci/check_meta.ml           |   17 +++++--
> >  parsing_cocci/cleanup_rules.ml        |    5 +-
> >  parsing_cocci/commas_on_lists.ml      |   10 ++--
> >  parsing_cocci/compute_lines.ml        |   25 ++++++++++
> >  parsing_cocci/context_neg.ml          |   47 +++++++++++++++++--
> >  parsing_cocci/disjdistr.ml            |   29 +++++++++---
> >  parsing_cocci/free_vars.ml            |   27 +++++------
> >  parsing_cocci/function_prototypes.ml  |    7 +-
> >  parsing_cocci/get_constants2.ml       |    7 +-
> >  parsing_cocci/index.ml                |    7 ++
> >  parsing_cocci/index.mli               |    2
> >  parsing_cocci/insert_plus.ml          |   39 +++++++++++++---
> >  parsing_cocci/iso_compile.ml          |    4 -
> >  parsing_cocci/iso_pattern.ml          |   80
> > ++++++++++++++++++++++++++++------
> >  parsing_cocci/parse_aux.ml            |    5 ++
> >  parsing_cocci/parse_aux.mli           |    9 +++
> >  parsing_cocci/parse_cocci.ml          |    4 -
> >  parsing_cocci/parser_cocci_menhir.mly |   13 ++---
> >  parsing_cocci/pretty_print_cocci.ml   |   18 +++++++
> >  parsing_cocci/re_constraints.ml       |   10 ++--
> >  parsing_cocci/safe_for_multi_decls.ml |   11 ++--
> >  parsing_cocci/single_statement.ml     |    5 +-
> >  parsing_cocci/stmtlist.ml             |    4 -
> >  parsing_cocci/unify_ast.ml            |   29 ++++++++++--
> >  parsing_cocci/unitary_ast0.ml         |    5 +-
> >  parsing_cocci/unparse_ast0.ml         |   22 ++++++++-
> >  parsing_cocci/visitor_ast.ml          |   72
> > +++++++++++++++++++++++++++---
> >  parsing_cocci/visitor_ast.mli         |    8 +++
> >  parsing_cocci/visitor_ast0.ml         |   72
> > ++++++++++++++++++++++++++++--
> >  parsing_cocci/visitor_ast0.mli        |    4 +
> >  parsing_cocci/visitor_ast0_types.ml   |   14 +++++
> >  parsing_cocci/visitor_ast0_types.mli  |   12 +++++
> >  popl/popltoctl.ml                     |    2
> >  popl09/popltoctl.ml                   |    5 +-
> >  tests/enum_assign.c                   |    6 ++
> >  tests/enum_assign.cocci               |   11 ++++
> >  tests/enum_assign.res                 |    7 ++
> >  tools/spgen/source/detect_patch.ml    |    6 +-
> >  tools/spgen/source/meta_variable.ml   |    6 +-
> >  tools/spgen/source/rule_body.ml       |    6 +-
> >  55 files changed, 748 insertions(+), 182 deletions(-)
> > 
> > 

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum
  2020-03-08  8:43 Jaskaran Singh
@ 2020-03-09 14:15 ` Julia Lawall
  2020-03-09 14:51   ` Jaskaran Singh
  0 siblings, 1 reply; 4+ messages in thread
From: Julia Lawall @ 2020-03-09 14:15 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: linux-kernel-mentees, cocci



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, expression))
>
> For the same, the SmPL AST is as follows:
>     EnumDef -> list of expression
>
> While the SmPL parser does make sure that enumerators are
> parsed as per C rules, the OCaml types for an enumerator themselves
> mismatch, due to their organization. This causes bugs/mismatches for
> cases where enums are in disjunctions.
>
> This patch series makes the enumerator type of the SmPL AST
> closer to that of the C AST. Various places in the codebase that
> handle an enum are also changed to match the new type, and
> collateral evolutions caused by changed in the SmPL visitors are
> handled as well.
>
> Changes are also made to Cocci_vs_c to correctly match two
> enumerators, and in Pretty_print_cocci and Unparse_cocci to
> correctly print an enumerator.

I have applied all of the changes.  In the end, I squashed all of the
commits together, to only commit something that compiles, but I
appreciated having the changes broken up into more understandable units.

thanks,
julia


>
> [PATCH 01/13] parsing_cocci: Align C AST and SmPL AST for enum
> [PATCH 02/13] ocaml: coccilib: Reflect changes in SmPL AST for
> [PATCH 03/13] parsing_cocci: parser: Parse enumerators correctly
> [PATCH 04/13] parsing_cocci: Add EnumDeclTag and EnumDeclDotsTag to
> [PATCH 05/13] ocaml: coccilib: Reflect EnumDeclTag and
> [PATCH 06/13] parsing_cocci: visitor_ast0: Add visitor functions for
> [PATCH 07/13] parsing_cocci: Reflect visitor_ast0 changes in
> [PATCH 08/13] parsing_cocci: Add visitor functions for enum_decl in
> [PATCH 09/13] cocci: Reflect changes in SmPL visitor_ast in codebase
> [PATCH 10/13] engine: cocci_vs_c: Match enumerators properly as per
> [PATCH 11/13] cocci: pretty print EnumDef as per enum_decl type
> [PATCH 12/13] tests: Add test case for assigned enumerator
> [PATCH 13/13] tools: spgen: Reflect visitor changes
>
>  cocci.ml                              |    4 -
>  engine/asttoctl2.ml                   |   21 +++++---
>  engine/asttomember.ml                 |   17 ++++---
>  engine/cocci_vs_c.ml                  |   46 ++++++++-----------
>  engine/transformation_c.ml            |    4 -
>  ocaml/coccilib.mli                    |   22 ++++++++-
>  parsing_c/unparse_cocci.ml            |   27 ++++++++++-
>  parsing_c/unparse_hrule.ml            |    4 -
>  parsing_cocci/arity.ml                |   25 ++++++++++
>  parsing_cocci/ast0_cocci.ml           |   15 +++++-
>  parsing_cocci/ast0_cocci.mli          |   14 +++++
>  parsing_cocci/ast0toast.ml            |   30 +++++++++++-
>  parsing_cocci/ast0toast.mli           |    4 +
>  parsing_cocci/ast_cocci.ml            |   13 +++++
>  parsing_cocci/ast_cocci.mli           |   12 ++++-
>  parsing_cocci/check_meta.ml           |   17 +++++--
>  parsing_cocci/cleanup_rules.ml        |    5 +-
>  parsing_cocci/commas_on_lists.ml      |   10 ++--
>  parsing_cocci/compute_lines.ml        |   25 ++++++++++
>  parsing_cocci/context_neg.ml          |   47 +++++++++++++++++--
>  parsing_cocci/disjdistr.ml            |   29 +++++++++---
>  parsing_cocci/free_vars.ml            |   27 +++++------
>  parsing_cocci/function_prototypes.ml  |    7 +-
>  parsing_cocci/get_constants2.ml       |    7 +-
>  parsing_cocci/index.ml                |    7 ++
>  parsing_cocci/index.mli               |    2
>  parsing_cocci/insert_plus.ml          |   39 +++++++++++++---
>  parsing_cocci/iso_compile.ml          |    4 -
>  parsing_cocci/iso_pattern.ml          |   80 ++++++++++++++++++++++++++++------
>  parsing_cocci/parse_aux.ml            |    5 ++
>  parsing_cocci/parse_aux.mli           |    9 +++
>  parsing_cocci/parse_cocci.ml          |    4 -
>  parsing_cocci/parser_cocci_menhir.mly |   13 ++---
>  parsing_cocci/pretty_print_cocci.ml   |   18 +++++++
>  parsing_cocci/re_constraints.ml       |   10 ++--
>  parsing_cocci/safe_for_multi_decls.ml |   11 ++--
>  parsing_cocci/single_statement.ml     |    5 +-
>  parsing_cocci/stmtlist.ml             |    4 -
>  parsing_cocci/unify_ast.ml            |   29 ++++++++++--
>  parsing_cocci/unitary_ast0.ml         |    5 +-
>  parsing_cocci/unparse_ast0.ml         |   22 ++++++++-
>  parsing_cocci/visitor_ast.ml          |   72 +++++++++++++++++++++++++++---
>  parsing_cocci/visitor_ast.mli         |    8 +++
>  parsing_cocci/visitor_ast0.ml         |   72 ++++++++++++++++++++++++++++--
>  parsing_cocci/visitor_ast0.mli        |    4 +
>  parsing_cocci/visitor_ast0_types.ml   |   14 +++++
>  parsing_cocci/visitor_ast0_types.mli  |   12 +++++
>  popl/popltoctl.ml                     |    2
>  popl09/popltoctl.ml                   |    5 +-
>  tests/enum_assign.c                   |    6 ++
>  tests/enum_assign.cocci               |   11 ++++
>  tests/enum_assign.res                 |    7 ++
>  tools/spgen/source/detect_patch.ml    |    6 +-
>  tools/spgen/source/meta_variable.ml   |    6 +-
>  tools/spgen/source/rule_body.ml       |    6 +-
>  55 files changed, 748 insertions(+), 182 deletions(-)
>
>
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum
@ 2020-03-08  8:43 Jaskaran Singh
  2020-03-09 14:15 ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Jaskaran Singh @ 2020-03-08  8:43 UTC (permalink / raw)
  To: cocci; +Cc: linux-kernel-mentees

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
parsed as per C rules, the OCaml types for an enumerator themselves
mismatch, due to their organization. This causes bugs/mismatches for
cases where enums are in disjunctions.
    
This patch series makes the enumerator type of the SmPL AST
closer to that of the C AST. Various places in the codebase that
handle an enum are also changed to match the new type, and
collateral evolutions caused by changed in the SmPL visitors are
handled as well.

Changes are also made to Cocci_vs_c to correctly match two
enumerators, and in Pretty_print_cocci and Unparse_cocci to
correctly print an enumerator.

[PATCH 01/13] parsing_cocci: Align C AST and SmPL AST for enum
[PATCH 02/13] ocaml: coccilib: Reflect changes in SmPL AST for
[PATCH 03/13] parsing_cocci: parser: Parse enumerators correctly
[PATCH 04/13] parsing_cocci: Add EnumDeclTag and EnumDeclDotsTag to
[PATCH 05/13] ocaml: coccilib: Reflect EnumDeclTag and
[PATCH 06/13] parsing_cocci: visitor_ast0: Add visitor functions for
[PATCH 07/13] parsing_cocci: Reflect visitor_ast0 changes in
[PATCH 08/13] parsing_cocci: Add visitor functions for enum_decl in
[PATCH 09/13] cocci: Reflect changes in SmPL visitor_ast in codebase
[PATCH 10/13] engine: cocci_vs_c: Match enumerators properly as per
[PATCH 11/13] cocci: pretty print EnumDef as per enum_decl type
[PATCH 12/13] tests: Add test case for assigned enumerator
[PATCH 13/13] tools: spgen: Reflect visitor changes

 cocci.ml                              |    4 -
 engine/asttoctl2.ml                   |   21 +++++---
 engine/asttomember.ml                 |   17 ++++---
 engine/cocci_vs_c.ml                  |   46 ++++++++-----------
 engine/transformation_c.ml            |    4 -
 ocaml/coccilib.mli                    |   22 ++++++++-
 parsing_c/unparse_cocci.ml            |   27 ++++++++++-
 parsing_c/unparse_hrule.ml            |    4 -
 parsing_cocci/arity.ml                |   25 ++++++++++
 parsing_cocci/ast0_cocci.ml           |   15 +++++-
 parsing_cocci/ast0_cocci.mli          |   14 +++++
 parsing_cocci/ast0toast.ml            |   30 +++++++++++-
 parsing_cocci/ast0toast.mli           |    4 +
 parsing_cocci/ast_cocci.ml            |   13 +++++
 parsing_cocci/ast_cocci.mli           |   12 ++++-
 parsing_cocci/check_meta.ml           |   17 +++++--
 parsing_cocci/cleanup_rules.ml        |    5 +-
 parsing_cocci/commas_on_lists.ml      |   10 ++--
 parsing_cocci/compute_lines.ml        |   25 ++++++++++
 parsing_cocci/context_neg.ml          |   47 +++++++++++++++++--
 parsing_cocci/disjdistr.ml            |   29 +++++++++---
 parsing_cocci/free_vars.ml            |   27 +++++------
 parsing_cocci/function_prototypes.ml  |    7 +-
 parsing_cocci/get_constants2.ml       |    7 +-
 parsing_cocci/index.ml                |    7 ++
 parsing_cocci/index.mli               |    2 
 parsing_cocci/insert_plus.ml          |   39 +++++++++++++---
 parsing_cocci/iso_compile.ml          |    4 -
 parsing_cocci/iso_pattern.ml          |   80 ++++++++++++++++++++++++++++------
 parsing_cocci/parse_aux.ml            |    5 ++
 parsing_cocci/parse_aux.mli           |    9 +++
 parsing_cocci/parse_cocci.ml          |    4 -
 parsing_cocci/parser_cocci_menhir.mly |   13 ++---
 parsing_cocci/pretty_print_cocci.ml   |   18 +++++++
 parsing_cocci/re_constraints.ml       |   10 ++--
 parsing_cocci/safe_for_multi_decls.ml |   11 ++--
 parsing_cocci/single_statement.ml     |    5 +-
 parsing_cocci/stmtlist.ml             |    4 -
 parsing_cocci/unify_ast.ml            |   29 ++++++++++--
 parsing_cocci/unitary_ast0.ml         |    5 +-
 parsing_cocci/unparse_ast0.ml         |   22 ++++++++-
 parsing_cocci/visitor_ast.ml          |   72 +++++++++++++++++++++++++++---
 parsing_cocci/visitor_ast.mli         |    8 +++
 parsing_cocci/visitor_ast0.ml         |   72 ++++++++++++++++++++++++++++--
 parsing_cocci/visitor_ast0.mli        |    4 +
 parsing_cocci/visitor_ast0_types.ml   |   14 +++++
 parsing_cocci/visitor_ast0_types.mli  |   12 +++++
 popl/popltoctl.ml                     |    2 
 popl09/popltoctl.ml                   |    5 +-
 tests/enum_assign.c                   |    6 ++
 tests/enum_assign.cocci               |   11 ++++
 tests/enum_assign.res                 |    7 ++
 tools/spgen/source/detect_patch.ml    |    6 +-
 tools/spgen/source/meta_variable.ml   |    6 +-
 tools/spgen/source/rule_body.ml       |    6 +-
 55 files changed, 748 insertions(+), 182 deletions(-)

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09  9:55 [Cocci] [PATCH 00/13] cocci: Align the C AST and SmPL AST for enum Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-03-08  8:43 Jaskaran Singh
2020-03-09 14:15 ` Julia Lawall
2020-03-09 14:51   ` Jaskaran Singh

Coccinelle archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/cocci/0 cocci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 cocci cocci/ https://lore.kernel.org/cocci \
		cocci@systeme.lip6.fr
	public-inbox-index cocci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/fr.lip6.systeme.cocci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git