All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute
@ 2020-07-26 14:30 Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-07-26 14:30 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: cocci

…
> +++ b/tests/metaattr.cocci
> @@ -0,0 +1,9 @@
> +@@
> +attribute name __attr__;
> +attribute a;
> +identifier b;
> +@@
> +
> +-	int
> ++	char
> +  b a = 1;

I have got understanding difficulties for this test SmPL script.
I interpret such SmPL code in the way that the metavariable “__attr__”
is declared while it is not used further.

Will the distinction between the metavariable types “attribute”
and “attribute name” trigger any extensions for the software documentation?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute
@ 2020-07-26 13:52 Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2020-07-26 13:52 UTC (permalink / raw)
  To: Jaskaran Singh; +Cc: cocci

…
> +++ b/tests/metaattr.c
> @@ -0,0 +1,5 @@
> +int main() {
> +	int b __attr__ = 1;
> +	int b = 1;
> +	return 0;
> +}

* Should such test code really work with a repeated definition of
  the variable “b”?

* Would you like to test here if the identifier “b” should be handled
  as an attribute for the variable “__attr__”?

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute
  2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
@ 2020-07-26 12:51 ` Jaskaran Singh
  0 siblings, 0 replies; 3+ messages in thread
From: Jaskaran Singh @ 2020-07-26 12:51 UTC (permalink / raw)
  To: cocci

Meta attributes are added to SmPL. Add test case to match and detect a
meta attribute in C code.

Signed-off-by: Jaskaran Singh <jaskaran.singh@collabora.com>
---
 tests/metaattr.c     | 5 +++++
 tests/metaattr.cocci | 9 +++++++++
 tests/metaattr.res   | 5 +++++
 3 files changed, 19 insertions(+)
 create mode 100644 tests/metaattr.c
 create mode 100644 tests/metaattr.cocci
 create mode 100644 tests/metaattr.res

diff --git a/tests/metaattr.c b/tests/metaattr.c
new file mode 100644
index 000000000..d3b091cd9
--- /dev/null
+++ b/tests/metaattr.c
@@ -0,0 +1,5 @@
+int main() {
+	int b __attr__ = 1;
+	int b = 1;
+	return 0;
+}
diff --git a/tests/metaattr.cocci b/tests/metaattr.cocci
new file mode 100644
index 000000000..a325ad06f
--- /dev/null
+++ b/tests/metaattr.cocci
@@ -0,0 +1,9 @@
+@@
+attribute name __attr__;
+attribute a;
+identifier b;
+@@
+
+-	int
++	char
+  b a = 1;
diff --git a/tests/metaattr.res b/tests/metaattr.res
new file mode 100644
index 000000000..9cd2014f2
--- /dev/null
+++ b/tests/metaattr.res
@@ -0,0 +1,5 @@
+int main() {
+	char b __attr__ = 1;
+	int b = 1;
+	return 0;
+}
-- 
2.21.3

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-26 14:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-26 14:30 [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute Markus Elfring
  -- strict thread matches above, loose matches on Subject: below --
2020-07-26 13:52 Markus Elfring
2020-07-26 12:50 [Cocci] [PATCH 00/43] cocci: Add support for meta attributes to SmPL Jaskaran Singh
2020-07-26 12:51 ` [Cocci] [PATCH 42/43] tests: Add test case to match meta attribute Jaskaran Singh

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.