From: mcgrof@kernel.org (Luis R. Rodriguez)
To: cocci@systeme.lip6.fr
Subject: [Cocci] [PATCH v2 1/3] tests: add test to remove single statement from branch
Date: Thu, 19 May 2016 16:08:54 -0700 [thread overview]
Message-ID: <1463699336-16151-2-git-send-email-mcgrof@kernel.org> (raw)
In-Reply-To: <1463699336-16151-1-git-send-email-mcgrof@kernel.org>
At leaset with coccinelle 1.0.4 this test fails with
two issues, one is the return statement is shifted,
another is debatable -- an empty branch statement is
left. This is funtional however its debatable if this
is desirable by default.
v2: do not remove the if -- the if is needed as the items
in the branch could consist of functional run time
changes, for instance if (bar()).
Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
tests/remove-code-in-branch1.c | 7 +++++++
tests/remove-code-in-branch1.cocci | 4 ++++
tests/remove-code-in-branch1.res | 7 +++++++
3 files changed, 18 insertions(+)
create mode 100644 tests/remove-code-in-branch1.c
create mode 100644 tests/remove-code-in-branch1.cocci
create mode 100644 tests/remove-code-in-branch1.res
diff --git a/tests/remove-code-in-branch1.c b/tests/remove-code-in-branch1.c
new file mode 100644
index 000000000000..83840bdd99ac
--- /dev/null
+++ b/tests/remove-code-in-branch1.c
@@ -0,0 +1,7 @@
+int main(void)
+{
+ if (a > 1)
+ c();
+
+ return 0;
+}
diff --git a/tests/remove-code-in-branch1.cocci b/tests/remove-code-in-branch1.cocci
new file mode 100644
index 000000000000..b3f03523ac92
--- /dev/null
+++ b/tests/remove-code-in-branch1.cocci
@@ -0,0 +1,4 @@
+ at r@
+@@
+
+-c();
diff --git a/tests/remove-code-in-branch1.res b/tests/remove-code-in-branch1.res
new file mode 100644
index 000000000000..eb7985f683a0
--- /dev/null
+++ b/tests/remove-code-in-branch1.res
@@ -0,0 +1,7 @@
+int main(void)
+{
+ if (a > 1)
+ {}
+
+ return 0;
+}
--
2.7.2
next prev parent reply other threads:[~2016-05-19 23:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-19 23:08 [Cocci] [PATCH v2 0/3] coccinelle: add control flow docs and demos Luis R. Rodriguez
2016-05-19 23:08 ` Luis R. Rodriguez [this message]
2016-05-21 13:03 ` [Cocci] [PATCH v2 1/3] tests: add test to remove single statement from branch Julia Lawall
2016-05-19 23:08 ` [Cocci] [PATCH v2 2/3] demos: add basic series of demos for exists and forall Luis R. Rodriguez
2016-05-21 7:08 ` SF Markus Elfring
2016-05-21 13:15 ` Julia Lawall
2016-05-19 23:08 ` [Cocci] [PATCH v2 3/3] coccinelle: add control flow documentation Luis R. Rodriguez
2016-05-20 11:45 ` SF Markus Elfring
2016-05-21 13:52 ` Julia Lawall
2016-05-21 14:37 ` SF Markus Elfring
2016-05-21 15:49 ` Julia Lawall
2016-05-21 15:08 ` SF Markus Elfring
2016-05-23 7:43 ` SF 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=1463699336-16151-2-git-send-email-mcgrof@kernel.org \
--to=mcgrof@kernel.org \
--cc=cocci@systeme.lip6.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.