On Wed, 4 Feb 2015, Cyril Hrubis wrote:

> Hi!
> I've found potentialy harmful bug while using spatch, see below.
>
> bug.c:
> int a; /* This is comment for a */
> int b; /* This is comment for b */
>
> bug.cocci:
> @@ @@
> -int b;
>
> spatch-23 bug.cocci bug.c
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> warning: line 2: should b be a metavariable?
> HANDLING: bug.c
> diff =
> --- bug.c
> +++ /tmp/cocci-output-2227-08362d-bug.c
> @@ -1,2 +1 @@
> -int a; /* This is comment for a */
> -int b; /* This is comment for b */
> +int a; /* This is comment for b */
>
> The comment for a is removed and replaced with the comment for b, which may
> lead to serious confusion.

Thanks.

I would have expected that both comments would stay.  I will look into it.
Thanks for the report.

julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to