[Linux-kernel-mentees] [PATCH v3 26/26] tests: Add test case for array of function pointers
Jaskaran Singh
jaskaransingh7654321 at gmail.com
Fri Mar 20 07:01:57 UTC 2020
Add a test case to match against an array of function pointers.
This would previously not work due to differences in the C
and SmPL ASTs.
Signed-off-by: Jaskaran Singh <jaskaransingh7654321 at gmail.com>
---
tests/funptr_array.c | 1 +
tests/funptr_array.cocci | 9 +++++++++
tests/funptr_array.res | 1 +
3 files changed, 11 insertions(+)
create mode 100644 tests/funptr_array.c
create mode 100644 tests/funptr_array.cocci
create mode 100644 tests/funptr_array.res
diff --git a/tests/funptr_array.c b/tests/funptr_array.c
new file mode 100644
index 00000000..dac29ac6
--- /dev/null
+++ b/tests/funptr_array.c
@@ -0,0 +1 @@
+int (*x[2])(int x);
diff --git a/tests/funptr_array.cocci b/tests/funptr_array.cocci
new file mode 100644
index 00000000..8027bcf4
--- /dev/null
+++ b/tests/funptr_array.cocci
@@ -0,0 +1,9 @@
+@@
+type T;
+identifier x;
+@@
+
+T (*x[2])(
+- int
++ char
+ x);
diff --git a/tests/funptr_array.res b/tests/funptr_array.res
new file mode 100644
index 00000000..72e1a14a
--- /dev/null
+++ b/tests/funptr_array.res
@@ -0,0 +1 @@
+int (*x[2])(char x);
--
2.21.1
More information about the Linux-kernel-mentees
mailing list