Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Andrzej Hajda <andrzej.hajda@intel.com>
To: cocci@inria.fr
Subject: [cocci] Another space oddity
Date: Wed, 14 Dec 2022 19:24:44 +0100	[thread overview]
Message-ID: <c2cb22fd-81aa-a27b-7ac7-77ee8bf74e11@intel.com> (raw)

Hi,

I have found another strange space/newline behavior when changing 
iterator loops:
Following script:
@@
iterator name for0;
@@
         for0()
-       {
                 0;
-       }

@@
iterator name for0;
@@
         for0()
-               { 1; }
+               1;

@@
iterator name for0;
@@
-       for0() { 2; }
+       for0() 2;
-----------
On file:
int f() {
         for0() {
                 0;
         }

         for0() {
                 1;
         }

         for0() {
                 2;
         }
}
Produces output:
int f() {
         for0()

                 0;

         for0() 1;

         for0 ()
                 2;
}
---
Ie. in cases:
0 - it adds extra line,
1 - removes existing line,
2 - produces correct output, but modifies iterator header (I would like 
to avoid, extra space between for0 and '('.

I would expect 0 and 1 produce correct indentation in 0 and 1, is it 
possible to fix it?

Regards
Andrzej

             reply	other threads:[~2022-12-14 18:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-14 18:24 Andrzej Hajda [this message]
2022-12-14 20:46 ` [cocci] Another space oddity Julia Lawall
2022-12-14 22:41   ` Andrzej Hajda
2022-12-18 16:13 ` Julia Lawall
2022-12-19  8:44   ` Andrzej Hajda

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=c2cb22fd-81aa-a27b-7ac7-77ee8bf74e11@intel.com \
    --to=andrzej.hajda@intel.com \
    --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).