linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
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 v3 23/23] tests: Add test case to detect parameter attributes
Date: Mon, 11 May 2020 15:43:00 +0530	[thread overview]
Message-ID: <20200511101300.11101-24-jaskaransingh7654321@gmail.com> (raw)
In-Reply-To: <20200511101300.11101-1-jaskaransingh7654321@gmail.com>

Add a test case to detect parameter attributes in C. The test case
changes the type of the parameter if it has the attribute. The cases
covered are for when the attribute is:

- before the parameter type.
- after the parameter type and before the parameter identifier.
- after the parameter identifier.

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

diff --git a/tests/detect_param_attr.c b/tests/detect_param_attr.c
new file mode 100644
index 00000000..160d6af2
--- /dev/null
+++ b/tests/detect_param_attr.c
@@ -0,0 +1,3 @@
+int func1(int __nocast u, __nocast int z, int q __nocast, int w) {
+	return 0;
+}
diff --git a/tests/detect_param_attr.cocci b/tests/detect_param_attr.cocci
new file mode 100644
index 00000000..53b8668f
--- /dev/null
+++ b/tests/detect_param_attr.cocci
@@ -0,0 +1,13 @@
+@@
+type T1, T2;
+attribute name __nocast;
+identifier x, y;
+@@
+
+T1 x(
+	...,
+-	T2
++	char
+	y __nocast,
+	...
+   ) {...}
diff --git a/tests/detect_param_attr.res b/tests/detect_param_attr.res
new file mode 100644
index 00000000..b3db290e
--- /dev/null
+++ b/tests/detect_param_attr.res
@@ -0,0 +1,3 @@
+int func1(char __nocast u, __nocast char z, char q __nocast, int w) {
+	return 0;
+}
-- 
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-05-11 10:14 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 10:12 [Linux-kernel-mentees] [PATCH v3 00/23] cocci: Add parameter attributes to SmPL Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 01/23] parsing_cocci: ast0_cocci: Add parameter attributes Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 02/23] parsing_cocci: parser: Parse Parameter attributes Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 03/23] parsing_cocci: visitor_ast0: Visit " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 04/23] parsing_cocci: arity: Reflect " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 05/23] parsing_cocci: check_meta: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 06/23] parsing_cocci: compute_lines: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 07/23] parsing_cocci: context_neg: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 08/23] parsing_cocci: function_prototypes: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 09/23] parsing_cocci: index: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 10/23] parsing_cocci: iso_pattern: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 11/23] parsing_cocci: type_infer: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 12/23] parsing_cocci: unparse_ast0: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 13/23] parsing_c: unparse_cocci: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 14/23] parsing_cocci: ast_cocci: Add " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 15/23] parsing_cocci: visitor_ast: Visit " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 16/23] parsing_cocci: ast0toast: Reflect " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 17/23] parsing_cocci: disjdistr: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 18/23] parsing_cocci: pretty_print_cocci: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 19/23] parsing_cocci: unify_ast: " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 20/23] engine: cocci_vs_c: Match " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 21/23] ocaml: coccilib: Reflect " Jaskaran Singh
2020-05-11 10:12 ` [Linux-kernel-mentees] [PATCH v3 22/23] tests: Add test case for removing parameter attributes Jaskaran Singh
2020-05-11 10:13 ` Jaskaran Singh [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=20200511101300.11101-24-jaskaransingh7654321@gmail.com \
    --to=jaskaransingh7654321@gmail.com \
    --cc=cocci@systeme.lip6.fr \
    --cc=julia.lawall@inria.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 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).