Struct end attributes are added to the SmPL and C ASTs. Add a test case
to detect a struct end attribute.

Signed-off-by: Jaskaran Singh <[email protected]>
---
 tests/detect_struct_endattr.c     | 13 +++++++++++++
 tests/detect_struct_endattr.cocci |  9 +++++++++
 tests/detect_struct_endattr.res   | 12 ++++++++++++
 3 files changed, 34 insertions(+)
 create mode 100644 tests/detect_struct_endattr.c
 create mode 100644 tests/detect_struct_endattr.cocci
 create mode 100644 tests/detect_struct_endattr.res

diff --git a/tests/detect_struct_endattr.c b/tests/detect_struct_endattr.c
new file mode 100644
index 00000000..240fcde9
--- /dev/null
+++ b/tests/detect_struct_endattr.c
@@ -0,0 +1,13 @@
+#define __struct_endattr MACROANNOTATION
+
+struct abcd {
+       int a;
+       int b;
+       int c;
+} __struct_endattr;
+
+struct abcd {
+       int a;
+       int b;
+       int c;
+};
diff --git a/tests/detect_struct_endattr.cocci 
b/tests/detect_struct_endattr.cocci
new file mode 100644
index 00000000..8b6ba797
--- /dev/null
+++ b/tests/detect_struct_endattr.cocci
@@ -0,0 +1,9 @@
+@@
+attribute name __struct_endattr;
+@@
+
+struct abcd {
+       ...
+-      int b;
+       ...
+} __struct_endattr;
diff --git a/tests/detect_struct_endattr.res b/tests/detect_struct_endattr.res
new file mode 100644
index 00000000..71002542
--- /dev/null
+++ b/tests/detect_struct_endattr.res
@@ -0,0 +1,12 @@
+#define __struct_endattr MACROANNOTATION
+
+struct abcd {
+       int a;
+       int c;
+} __struct_endattr;
+
+struct abcd {
+       int a;
+       int b;
+       int c;
+};
-- 
2.21.1

_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to