All of lore.kernel.org
 help / color / mirror / Atom feed
* [cocci] Bug with '*' to display a match on the subsequent rule.
@ 2022-03-19  1:26 Eric Wheeler
  2022-03-19  8:23 ` Julia Lawall
  0 siblings, 1 reply; 9+ messages in thread
From: Eric Wheeler @ 2022-03-19  1:26 UTC (permalink / raw)
  To: cocci

Hello,

I may have found a bug:

	@ r1 @
	type T;
	identifier I;
	@@
	*T I;

	@ r2 @
	@@
	f()
	{
	}
	+void a(){}

which prints this error:

	init_defs_builtins: /usr/local/coccinelle-git/bin/lib/coccinelle/standard.h
	File "cocci/broken.cocci", line 12, column 0, charpos = 57
	  around = '+',
	  whole content = +void a(){}

but if I remove the '*' or turn it to a '-' then it works:

	@ r1 @
	type T;
	identifier I;
	@@
	-T I;

	@ r2 @
	@@
	f()
	{
	}
	+void a(){}

with the diff:

	--- t.c
	+++ /tmp/cocci-output-6974-08cd95-t.c
	@@ -5,11 +5,13 @@ typedef struct
		int w;
	 } A;
	 
	-A a, b;
	-
	 #define NOMATCH(s1, s2, member) printf(#s1  "." #member "!=" #s2 "." #member);
	 f()
	 {
	 }
	 
	+void a()
	+{
	+}
	+
	 // functions here


Here is the t.c file:

	typedef struct 
	{
		int x, y, z;
		int u, v;
		int w;
	} A;

	A a, b;

	#define NOMATCH(s1, s2, member) printf(#s1  "." #member "!=" #s2 "." #member);
	f()
	{
	}

	// functions here

--
Eric Wheeler

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

end of thread, other threads:[~2022-03-20 15:30 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-19  1:26 [cocci] Bug with '*' to display a match on the subsequent rule Eric Wheeler
2022-03-19  8:23 ` Julia Lawall
2022-03-19 10:31   ` Markus Elfring
2022-03-19 17:00     ` Eric Wheeler
2022-03-19 20:12       ` Julia Lawall
2022-03-20  7:48         ` [cocci] Improved error handling for mixed SmPL data processing indicators Markus Elfring
2022-03-20  8:50           ` Julia Lawall
2022-03-20  9:07             ` Markus Elfring
2022-03-20 15:30             ` [cocci] Improving descriptions for SmPL data processing indicators? Markus Elfring

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.