浏览代码

Add a coccinelle script that removes all occurences of the "where" field of the "starpu_codelet" structure.

* Should work on most cases
* Does not remove "where" fields of structures other than "struct starpu_codelet"
Cyril Roelandt 13 年之前
父节点
当前提交
b236f9013e
共有 2 个文件被更改,包括 45 次插入0 次删除
  1. 19 0
      tools/dev/experimental/remove_where_field.cocci
  2. 26 0
      tools/dev/experimental/remove_where_field_test.c

+ 19 - 0
tools/dev/experimental/remove_where_field.cocci

@@ -0,0 +1,19 @@
+@@
+identifier c;
+expression E;
+@@
+struct starpu_codelet c = {
+-	.where = E
+};
+
+@@
+struct starpu_codelet cl;
+expression E;
+@@
+-cl.where = E;
+
+@@
+struct starpu_codelet*  pointer_to_cl;
+expression E;
+@@
+- pointer_to_cl->where = E;

+ 26 - 0
tools/dev/experimental/remove_where_field_test.c

@@ -0,0 +1,26 @@
+struct dummy_struct
+{
+	int where;
+};
+
+
+/* Simple example : remove the where field */
+struct starpu_codelet cl = {
+	.cuda_func = bar,
+	.where = STARPU_CPU | STARPU_OPENCL,
+	.cpu_func = foo
+};
+
+
+void
+dummy(void)
+{
+	cl.where = STARPU_CUDA;
+	starpu_codelet_t *clp = &cl;
+	clp->where = STARPU_CPU; /* Must be removed */
+
+	struct dummy_struct ds;
+	struct dummy_struct *dsp = &ds;
+	ds.where = 12;   /* Must not be removed */
+	dsp->where = 12; /* Must not be removed */ 
+}