浏览代码

coccinelle: deref_null: avoid useless computation

The effect of the rules ifm1, pr11, and pr12 is only used in the final rule,
which depends on context && !org && !report.  Thus these rules should only
be performed in those circumstances.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Julia Lawall 7 年之前
父节点
当前提交
a2b0fe7435
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      scripts/coccinelle/null/deref_null.cocci

+ 3 - 3
scripts/coccinelle/null/deref_null.cocci

@@ -212,7 +212,7 @@ else S3
 // The following three rules are duplicates of ifm, pr1 and pr2 respectively.
 // The following three rules are duplicates of ifm, pr1 and pr2 respectively.
 // It is need because the previous rule as already made a "change".
 // It is need because the previous rule as already made a "change".
 
 
-@ifm1@
+@ifm1 depends on context && !org && !report@
 expression *E;
 expression *E;
 statement S1,S2;
 statement S1,S2;
 position p1;
 position p1;
@@ -220,7 +220,7 @@ position p1;
 
 
 if@p1 ((E == NULL && ...) || ...) S1 else S2
 if@p1 ((E == NULL && ...) || ...) S1 else S2
 
 
-@pr11 expression@
+@pr11 depends on context && !org && !report expression@
 expression *ifm1.E;
 expression *ifm1.E;
 identifier f;
 identifier f;
 position p1;
 position p1;
@@ -228,7 +228,7 @@ position p1;
 
 
  (E != NULL && ...) ? <+...E->f@p1...+> : ...
  (E != NULL && ...) ? <+...E->f@p1...+> : ...
 
 
-@pr12 expression@
+@pr12 depends on context && !org && !report expression@
 expression *ifm1.E;
 expression *ifm1.E;
 identifier f;
 identifier f;
 position p2;
 position p2;