Coccinelle archive mirror
 help / color / mirror / Atom feed
From: Andrzej Hajda <andrzej.hajda@intel.com>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: cocci@inria.fr
Subject: Re: [cocci] Another space oddity
Date: Mon, 19 Dec 2022 09:44:15 +0100	[thread overview]
Message-ID: <f9322697-5e78-1679-6dbb-ffe2bbc1e046@intel.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2212181712570.37242@hadrien>



On 18.12.2022 17:13, Julia Lawall wrote:
>
> On Wed, 14 Dec 2022, Andrzej Hajda wrote:
>
>> 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 '('.
> To avoid the space, you can use the argument --smpl-spacing.  Then it will
> follow the spacing strategy found in the semantic patch.

Thanks for the hint.

Regards
Andrzej

>
> julia


      reply	other threads:[~2022-12-19  8:44 UTC|newest]

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

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=f9322697-5e78-1679-6dbb-ffe2bbc1e046@intel.com \
    --to=andrzej.hajda@intel.com \
    --cc=cocci@inria.fr \
    --cc=julia.lawall@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).