[Linux-kernel-mentees] [Cocci] [PATCH 2/2] tests: Add test case for user comments attached to identifiers

Markus Elfring Markus.Elfring at web.de
Fri Jan 10 18:39:35 UTC 2020


> Add a test case for both of the erroneous cases.

Thanks for your contribution.

Will a slightly different subject be more appropriate for this patch?


> +@ r0 @
> +type t;
> +position p;

I suggest to omit this variable for the shown simple SmPL script.


> +@ script:python r1 @
> +id;
> +@@
> +coccinelle.id = "id/* user comment */"
> +
> +@ r2 @
> +identifier r1.id;
> +type r0.t;
> +@@
> +foo() {
> +...
> +++ t id;
> +}

This variable assignment and the addition of commented variable declarations
looks interesting.

* Can such a change be achieved also directly without using an extra
  Python (or OCaml) script?

* I would usually prefer to avoid the generation of duplicate source code.
  The corresponding example might demonstrate other test goals.

Regards,
Markus


More information about the Linux-kernel-mentees mailing list