diff options
author | Julia Lawall <Julia.Lawall@lip6.fr> | 2012-04-21 14:14:58 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2012-05-25 08:51:11 -0400 |
commit | 4619c2b8304a0751d9ec2ba89e11f387977c8cb4 (patch) | |
tree | 6563676768057551105790cc898edf7c6b825a38 /scripts | |
parent | dd775ae2549217d3ae09363e3edb305d0fa19928 (diff) |
scripts/coccinelle: address test is always true
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/coccinelle/misc/ifaddr.cocci | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/scripts/coccinelle/misc/ifaddr.cocci b/scripts/coccinelle/misc/ifaddr.cocci new file mode 100644 index 000000000000..3e4089a77000 --- /dev/null +++ b/scripts/coccinelle/misc/ifaddr.cocci | |||
@@ -0,0 +1,35 @@ | |||
1 | /// the address of a variable or field is non-zero is likely always to bo | ||
2 | /// non-zero | ||
3 | /// | ||
4 | // Confidence: High | ||
5 | // Copyright: (C) 2012 Julia Lawall, INRIA/LIP6. GPLv2. | ||
6 | // Copyright: (C) 2012 Gilles Muller, INRIA/LiP6. GPLv2. | ||
7 | // URL: http://coccinelle.lip6.fr/ | ||
8 | // Comments: | ||
9 | // Options: -no_includes -include_headers | ||
10 | |||
11 | virtual org | ||
12 | virtual report | ||
13 | virtual context | ||
14 | |||
15 | @r@ | ||
16 | expression x; | ||
17 | statement S1,S2; | ||
18 | position p; | ||
19 | @@ | ||
20 | |||
21 | *if@p (&x) | ||
22 | S1 else S2 | ||
23 | |||
24 | @script:python depends on org@ | ||
25 | p << r.p; | ||
26 | @@ | ||
27 | |||
28 | cocci.print_main("test of a variable/field address",p) | ||
29 | |||
30 | @script:python depends on report@ | ||
31 | p << r.p; | ||
32 | @@ | ||
33 | |||
34 | msg = "ERROR: test of a variable/field address" | ||
35 | coccilib.report.print_report(p[0],msg) | ||