Release coccinelle-0.2.0rc1
[bpt/coccinelle.git] / scripts / coccicheck / cocci / noderef2.cocci
1 //
2 // sizeof argument must be return the size of the
3 // data, no the size of the pointer to it.
4 //
5
6 virtual org, patch, diff
7
8 @ depends on patch && !org && !diff@
9 type T;
10 T *x;
11 expression E;
12 @@
13
14 memset(x, E, sizeof(
15 + *
16 x))
17
18 @ depends on !patch && !org && diff@
19 type T;
20 T *x;
21 expression E;
22 @@
23
24 *memset(x, E, sizeof(x))
25
26 @r depends on !patch && org && !diff@
27 type T;
28 T *x;
29 expression E;
30 position p;
31 @@
32
33 memset(x, E, sizeof(x@p))
34
35 @script:python@
36 x << r.x;
37 p << r.p;
38 @@
39
40 cocci.print_main(x, p)