From: Andrzej Hajda <andrzej.hajda@intel.com>
To: cocci@inria.fr
Subject: [cocci] spatch adds zero or two lines after if statement
Date: Fri, 14 Oct 2022 14:03:39 +0200 [thread overview]
Message-ID: <7bda3ec2-1335-4451-dc59-b70faa216750@intel.com> (raw)
Adding 'if' statement to the code does not add empty line after it, as
expected, but if I explicitly add empty line spatch adds two lines, and
this is unexpected. How can I convince spatch to add exactly one line?
Following script:
@@
@@
+ if (1)
+ printf("a\n");
return 0;
@@
@@
+ if (1)
+ printf("b\n");
+
return 1;
##### EOF
used on file:
int a()
{
return 0;
}
int b()
{
return 1;
}
##### EOF
produces:
@@ -1,9 +1,15 @@
int a()
{
+ if (1)
+ printf("a\n");
return 0;
}
int b()
{
+ if (1)
+ printf("b\n");
+
+
return 0;
}
##### EOF
Regards
Andrzej
next reply other threads:[~2022-10-14 12:03 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-14 12:03 Andrzej Hajda [this message]
2022-10-14 12:33 ` [cocci] spatch adds zero or two lines after if statement Julia Lawall
2022-10-15 12:12 ` Markus Elfring
2022-10-15 15:12 ` [cocci] How to fix diff generation for adding if statements before return statements? Markus Elfring
2022-10-15 15:34 ` Julia Lawall
2022-10-15 18:40 ` Markus Elfring
2022-10-16 8:50 ` Markus Elfring
2022-10-18 16:34 ` [cocci] spatch adds zero or two lines after if statement Julia Lawall
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=7bda3ec2-1335-4451-dc59-b70faa216750@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).