lkml.org 
[lkml]   [2015]   [Jan]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3 RFC] Coccinelle: check for incorrect DECLARE_COMPLETION use
Date
Reviewed-by: Andreas Platschek <platschek@ict.tuwien.ac.at>
Signed-off-by: Nicholas Mc Guire <der.herr@hofr.at>
---
.../coccinelle/api/false_declare_completion.cocci | 50 ++++++++++++++++++++
1 file changed, 50 insertions(+)
create mode 100644 scripts/coccinelle/api/false_declare_completion.cocci

diff --git a/scripts/coccinelle/api/false_declare_completion.cocci b/scripts/coccinelle/api/false_declare_completion.cocci
new file mode 100644
index 0000000..a0e3d6c
--- /dev/null
+++ b/scripts/coccinelle/api/false_declare_completion.cocci
@@ -0,0 +1,50 @@
+/* check for incorrect DECLARE_COMPLETION use within a function
+ *
+ * Options: --no-includes --include-headers
+ */
+virtual context
+virtual patch
+virtual org
+virtual report
+
+/* flag incorrect initializer*/
+@e depends on patch && !(context || org || report)@
+expression cmp;
+identifier f;
+declarer name DECLARE_COMPLETION;
+position p;
+@@
+
+f(...) {
+ <...
+- DECLARE_COMPLETION@p(cmp);
++ DECLARE_COMPLETION_ONSTACK(cmp);
+ ...>
+}
+
+@ep depends on !patch && (context || org || report)@
+expression cmp;
+identifier f;
+position p;
+@@
+
+f(...) {
+ <...
+* DECLARE_COMPLETION@p(cmp);
+ ...>
+}
+
+@script:python depends on org@
+p << ep.p;
+@@
+
+msg="WARNING: possible incorrect use of DECLARE_COMPLETION"
+coccilib.org.print_todo(p[0], msg)
+
+@script:python depends on report@
+p << ep.p;
+@@
+
+msg="WARNING: possible incorrect use of DECLARE_COMPLETION"
+coccilib.report.print_report(p[0], msg)
+
--
1.7.10.4


\
 
 \ /
  Last update: 2015-01-02 11:21    [W:0.071 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site