Browse Source

Use the report virtual rule in cuda_check_return_values.cocci

Cyril Roelandt 13 years ago
parent
commit
d790a14209
1 changed files with 4 additions and 14 deletions
  1. 4 14
      tools/dev/experimental/cuda_check_return_values.cocci

+ 4 - 14
tools/dev/experimental/cuda_check_return_values.cocci

@@ -12,9 +12,8 @@
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 //
 // See the GNU Lesser General Public License in COPYING.LGPL for more details.
-@initialize:python@
-l = []
 
+virtual report
 
 @seek@
 identifier func;
@@ -53,18 +52,9 @@ position p;
 cuda_func@p(...);
 
 
-@script:python@
+@script:python depends on no_assignment && report@
 p << no_assignment.p;
 func << no_assignment.cuda_func;
 @@
-l.append((p[0], func));
-
-
-@finalize:python@
-for e in l:
-	p, f = e[0], e[1]
-	print "%s:%s : the return value of %s is ignored" % (p.file, p.line, f)
-print "This should probably be patched by either :"
-print " * Checking the return value of the function : cudaError_t ret = f(...);"
-print " * Explicitely ignoring its return value : (void) f(...)"
-
+msg = "Ignoring the return value of %s." % func
+coccilib.report.print_report(p[0], msg)