All of lore.kernel.org
 help / color / mirror / Atom feed
* [Cocci] broken comments handling
@ 2015-02-04  8:39 Cyril Hrubis
  2015-02-04 12:38 ` Julia Lawall
  0 siblings, 1 reply; 13+ messages in thread
From: Cyril Hrubis @ 2015-02-04  8:39 UTC (permalink / raw)
  To: cocci

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.

-- 
Cyril Hrubis
chrubis at suse.cz

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

end of thread, other threads:[~2015-02-04 14:15 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-04  8:39 [Cocci] broken comments handling Cyril Hrubis
2015-02-04 12:38 ` Julia Lawall
2015-02-04 12:59   ` Cyril Hrubis
2015-02-04 13:02     ` Julia Lawall
2015-02-04 13:23     ` [Cocci] Source code adjustments together with comments? SF Markus Elfring
2015-02-04 13:27       ` Julia Lawall
2015-02-04 13:35         ` Cyril Hrubis
2015-02-04 13:38           ` Julia Lawall
2015-02-04 13:50           ` Rasmus Villemoes
2015-02-04 13:53             ` Julia Lawall
2015-02-04 13:33       ` Cyril Hrubis
2015-02-04 13:41         ` SF Markus Elfring
2015-02-04 14:15           ` Cyril Hrubis

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.