All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Cocci] [PATCH v2 2/2] tests: Add test case to match const pointer variants
Date: Fri,  7 Feb 2020 11:39:38 +0530	[thread overview]
Message-ID: <20200207060938.9531-3-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200207060938.9531-1-jaskaransingh7654321@gmail.com>

Pointer to const pointer and its variants would not match previously.
Add a test case for matching these types.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
 tests/constptr.c     |  7 +++++++
 tests/constptr.cocci | 19 +++++++++++++++++++
 tests/constptr.res   |  7 +++++++
 3 files changed, 33 insertions(+)
 create mode 100644 tests/constptr.c
 create mode 100644 tests/constptr.cocci
 create mode 100644 tests/constptr.res

diff --git a/tests/constptr.c b/tests/constptr.c
new file mode 100644
index 00000000..13fe064c
--- /dev/null
+++ b/tests/constptr.c
@@ -0,0 +1,7 @@
+int main()
+{
+	const char * const * id;
+	const char * * const * id;
+	const char * const * * id;
+	const char * const id;
+}
diff --git a/tests/constptr.cocci b/tests/constptr.cocci
new file mode 100644
index 00000000..29f0aa96
--- /dev/null
+++ b/tests/constptr.cocci
@@ -0,0 +1,19 @@
+@ r0 @
+identifier id;
+@@
+const char * const *
+- id
++ id1
+;
+const char * * const *
+- id
++ id2
+;
+const char * const * *
+- id
++ id3
+;
+const char * const
+- id
++ id4
+;
diff --git a/tests/constptr.res b/tests/constptr.res
new file mode 100644
index 00000000..0af4de9a
--- /dev/null
+++ b/tests/constptr.res
@@ -0,0 +1,7 @@
+int main()
+{
+	const char * const * id1;
+	const char * * const * id2;
+	const char * const * * id3;
+	const char * const id4;
+}
-- 
2.21.1

_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

WARNING: multiple messages have this Message-ID (diff)
From: Jaskaran Singh <jaskaransingh7654321@gmail.com>
To: cocci@systeme.lip6.fr
Cc: julia.lawall@inria.fr, jaskaransingh7654321@gmail.com,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [Linux-kernel-mentees] [PATCH v2 2/2] tests: Add test case to match const pointer variants
Date: Fri,  7 Feb 2020 11:39:38 +0530	[thread overview]
Message-ID: <20200207060938.9531-3-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200207060938.9531-1-jaskaransingh7654321@gmail.com>

Pointer to const pointer and its variants would not match previously.
Add a test case for matching these types.

Signed-off-by: Jaskaran Singh <jaskaransingh7654321@gmail.com>
---
 tests/constptr.c     |  7 +++++++
 tests/constptr.cocci | 19 +++++++++++++++++++
 tests/constptr.res   |  7 +++++++
 3 files changed, 33 insertions(+)
 create mode 100644 tests/constptr.c
 create mode 100644 tests/constptr.cocci
 create mode 100644 tests/constptr.res

diff --git a/tests/constptr.c b/tests/constptr.c
new file mode 100644
index 00000000..13fe064c
--- /dev/null
+++ b/tests/constptr.c
@@ -0,0 +1,7 @@
+int main()
+{
+	const char * const * id;
+	const char * * const * id;
+	const char * const * * id;
+	const char * const id;
+}
diff --git a/tests/constptr.cocci b/tests/constptr.cocci
new file mode 100644
index 00000000..29f0aa96
--- /dev/null
+++ b/tests/constptr.cocci
@@ -0,0 +1,19 @@
+@ r0 @
+identifier id;
+@@
+const char * const *
+- id
++ id1
+;
+const char * * const *
+- id
++ id2
+;
+const char * const * *
+- id
++ id3
+;
+const char * const
+- id
++ id4
+;
diff --git a/tests/constptr.res b/tests/constptr.res
new file mode 100644
index 00000000..0af4de9a
--- /dev/null
+++ b/tests/constptr.res
@@ -0,0 +1,7 @@
+int main()
+{
+	const char * const * id1;
+	const char * * const * id2;
+	const char * const * * id3;
+	const char * const id4;
+}
-- 
2.21.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

  parent reply	other threads:[~2020-02-07  6:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 13:03 [Cocci] [PATCH 0/2] cocci: Align the C AST and Cocci AST for pointer Jaskaran Singh
2020-02-05 13:03 ` [Linux-kernel-mentees] " Jaskaran Singh
2020-02-05 13:03 ` [Cocci] [PATCH 1/2] parsing_c: Align " Jaskaran Singh
2020-02-05 13:03   ` [Linux-kernel-mentees] " Jaskaran Singh
2020-02-05 13:03 ` [Cocci] [PATCH 2/2] tests: Add test case for matching ptr to const ptr and variants Jaskaran Singh
2020-02-05 13:03   ` [Linux-kernel-mentees] " Jaskaran Singh
2020-02-07  6:09 ` [Cocci] [PATCH v2 0/2] cocci: Align the C AST and Cocci AST for pointer Jaskaran Singh
2020-02-07  6:09   ` [Linux-kernel-mentees] " Jaskaran Singh
2020-02-07  6:09   ` [Cocci] [PATCH v2 1/2] parsing_c: Align " Jaskaran Singh
2020-02-07  6:09     ` [Linux-kernel-mentees] " Jaskaran Singh
2020-02-09  7:14     ` [Cocci] " Julia Lawall
2020-02-09  7:14       ` [Linux-kernel-mentees] " Julia Lawall
2020-02-07  6:09   ` Jaskaran Singh [this message]
2020-02-07  6:09     ` [Linux-kernel-mentees] [PATCH v2 2/2] tests: Add test case to match const pointer variants Jaskaran Singh
2020-02-09  7:20     ` [Cocci] " Julia Lawall
2020-02-09  7:20       ` [Linux-kernel-mentees] " Julia Lawall
2020-02-09  7:58       ` [Cocci] " Jaskaran Singh
2020-02-09  7:58         ` [Linux-kernel-mentees] " Jaskaran Singh
2020-02-09  8:07         ` [Cocci] " Julia Lawall
2020-02-09  8:07           ` [Linux-kernel-mentees] " Julia Lawall
2020-02-09  8:09           ` [Cocci] " Jaskaran Singh
2020-02-09  8:09             ` [Linux-kernel-mentees] " Jaskaran Singh

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=20200207060938.9531-3-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=linux-kernel-mentees@lists.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 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.