From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: linux-kernel-mentees@lists.linuxfoundation.org,
skhan@linuxfoundation.org
Subject: [Cocci] [PATCH 2/2] tests: Add test case for statement removed and added
Date: Wed, 27 Nov 2019 23:08:15 +0530 [thread overview]
Message-ID: <20191127173815.24988-3-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20191127173815.24988-1-jaskaransingh7654321@gmail.com>
This is in response to the following "continue statement of death"
report:
https://www.mail-archive.com/cocci@systeme.lip6.fr/msg06199.html
Coccinelle would crash in similar cases, so add a test case for it.
Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
tests/stmt_removed_and_added.c | 8 ++++++++
tests/stmt_removed_and_added.cocci | 7 +++++++
tests/stmt_removed_and_added.res | 8 ++++++++
3 files changed, 23 insertions(+)
create mode 100644 tests/stmt_removed_and_added.c
create mode 100644 tests/stmt_removed_and_added.cocci
create mode 100644 tests/stmt_removed_and_added.res
diff --git a/tests/stmt_removed_and_added.c b/tests/stmt_removed_and_added.c
new file mode 100644
index 00000000..cbc64f42
--- /dev/null
+++ b/tests/stmt_removed_and_added.c
@@ -0,0 +1,8 @@
+void main()
+{
+ for(i; j; k) {
+ if (1)
+ continue;
+ c++;
+ }
+}
diff --git a/tests/stmt_removed_and_added.cocci b/tests/stmt_removed_and_added.cocci
new file mode 100644
index 00000000..93558a19
--- /dev/null
+++ b/tests/stmt_removed_and_added.cocci
@@ -0,0 +1,7 @@
+@@
+expression I, J, K;
+statement S;
+@@
+
+- for (I; J; K) S
++ while(1) S
diff --git a/tests/stmt_removed_and_added.res b/tests/stmt_removed_and_added.res
new file mode 100644
index 00000000..4b20027a
--- /dev/null
+++ b/tests/stmt_removed_and_added.res
@@ -0,0 +1,8 @@
+void main()
+{
+ while (1) {
+ if (1)
+ continue;
+ c++;
+ }
+}
--
2.21.0
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
next prev parent reply other threads:[~2019-11-27 17:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-27 17:38 [Cocci] [PATCH 0/2] cocci: Fix continue statement of death and similar cases Jaskaran Singh
2019-11-27 17:38 ` [Cocci] [PATCH 1/2] engine: remove circular references in MINUS/NOREPLACEMENT case Jaskaran Singh
2019-11-27 20:41 ` Markus Elfring
2019-11-27 17:38 ` Jaskaran Singh [this message]
2019-11-27 20:43 ` [Cocci] [PATCH 0/2] cocci: Fix continue statement of death and similar cases 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=20191127173815.24988-3-jaskaransingh7654321@gmail.com \
--to=jaskaransingh7654321@gmail.com \
--cc=cocci@systeme.lip6.fr \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=skhan@linuxfoundation.org \
/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 NNTP newsgroup(s).