Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Anon Anonson <anon@chud.cyou>
To: cocci@inria.fr
Subject: [cocci] Possible bug
Date: Sun, 14 Sep 2025 13:47:08 +0200	[thread overview]
Message-ID: <d04274ea-7bff-4c63-8fc6-55a19ab45b55@chud.cyou> (raw)

[-- Attachment #1: Type: text/plain, Size: 602 bytes --]

Greetings,

I was playing around with spatch in an attempt to create a wrapper 
utility for renaming.

Given the following script:
@ rn_dec @
type T;
identifier I = i;
@@

- T I
+ T b
;

And the following input:
void f() {
     int i;
     for (int i;;) { ; }
}

The following patch is generated:
diff =
--- main.c
+++ /tmp/cocci-output-9754-fec11b-main.c
@@ -1,4 +1,4 @@
  void f() {
-    int i;
+    int b;
      for (int i;;) { ; }
  }

However, I would expect the declaration inside the 'for' to be replaced too.
My only questions is: is the observed behaviour intended?

Cheers!

[-- Attachment #2: Type: text/html, Size: 1231 bytes --]

             reply	other threads:[~2025-09-15 21:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-14 11:47 Anon Anonson [this message]
2025-09-15 21:37 ` [cocci] Possible bug Julia Lawall
2025-10-19 19:34   ` Anon Anonson
2025-09-16  8:00 ` [cocci] Renaming identifiers with SmPL Markus Elfring
2025-09-16  8:25 ` [cocci] Renaming identifiers with SmPL? 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=d04274ea-7bff-4c63-8fc6-55a19ab45b55@chud.cyou \
    --to=anon@chud.cyou \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).