All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Wheeler <cocci@lists.ewheeler.net>
To: cocci@inria.fr
Subject: [cocci] Bug with '*' to display a match on the subsequent rule.
Date: Fri, 18 Mar 2022 18:26:25 -0700 (PDT)	[thread overview]
Message-ID: <30124bde-34e-65ca-d5bc-fc3255ccda3@ewheeler.net> (raw)

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

             reply	other threads:[~2022-03-19  1:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19  1:26 Eric Wheeler [this message]
2022-03-19  8:23 ` [cocci] Bug with '*' to display a match on the subsequent rule 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=30124bde-34e-65ca-d5bc-fc3255ccda3@ewheeler.net \
    --to=cocci@lists.ewheeler.net \
    --cc=cocci@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.