diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2018-02-03 02:44:58 -0500 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-02-07 10:16:12 -0500 |
commit | a2b0fe7435faee6f6fbb27409878013bc4727e98 (patch) | |
tree | 38e8875a759e3ed8150d066c3a98600d6e7e5050 | |
parent | e856f3a7d706b37d8be9b41e41b19f4919570e57 (diff) |
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>
-rw-r--r-- | scripts/coccinelle/null/deref_null.cocci | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/coccinelle/null/deref_null.cocci b/scripts/coccinelle/null/deref_null.cocci index f192d6035d02..b16ccb7663a7 100644 --- a/scripts/coccinelle/null/deref_null.cocci +++ b/scripts/coccinelle/null/deref_null.cocci | |||
@@ -212,7 +212,7 @@ else S3 | |||
212 | // The following three rules are duplicates of ifm, pr1 and pr2 respectively. | 212 | // The following three rules are duplicates of ifm, pr1 and pr2 respectively. |
213 | // It is need because the previous rule as already made a "change". | 213 | // It is need because the previous rule as already made a "change". |
214 | 214 | ||
215 | @ifm1@ | 215 | @ifm1 depends on context && !org && !report@ |
216 | expression *E; | 216 | expression *E; |
217 | statement S1,S2; | 217 | statement S1,S2; |
218 | position p1; | 218 | position p1; |
@@ -220,7 +220,7 @@ position p1; | |||
220 | 220 | ||
221 | if@p1 ((E == NULL && ...) || ...) S1 else S2 | 221 | if@p1 ((E == NULL && ...) || ...) S1 else S2 |
222 | 222 | ||
223 | @pr11 expression@ | 223 | @pr11 depends on context && !org && !report expression@ |
224 | expression *ifm1.E; | 224 | expression *ifm1.E; |
225 | identifier f; | 225 | identifier f; |
226 | position p1; | 226 | position p1; |
@@ -228,7 +228,7 @@ position p1; | |||
228 | 228 | ||
229 | (E != NULL && ...) ? <+...E->f@p1...+> : ... | 229 | (E != NULL && ...) ? <+...E->f@p1...+> : ... |
230 | 230 | ||
231 | @pr12 expression@ | 231 | @pr12 depends on context && !org && !report expression@ |
232 | expression *ifm1.E; | 232 | expression *ifm1.E; |
233 | identifier f; | 233 | identifier f; |
234 | position p2; | 234 | position p2; |