summaryrefslogtreecommitdiffstats
path: root/devel/coccinelle/test/ref-passed-variables-inited.input.c
blob: 9ddb626fd197ca0fd50240081881945fd3a21e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
void foo(int *z) {
	return:
}
void baz(int z) {
	return;
}
void zob1(int **z) {
	return;
}
void zob2(int ***z) {
	return;
}

void bar0(void) {
	int i;
	foo(&i);
	baz(i);
}

void bar1(void) {
	int i;
	foo(&i);
	foo(&i);
}

void bar2(void) {
	int a = 1, b, c = 3;
	foo(&a);
	baz(a);
	foo(&b);
	baz(b);
	foo(&c);
	baz(c);
}

void bar3(int *w) {
	int i;
	foo(&i);
	*w = i;
}

void bar4(int **w) {
	int i;
	foo(&i);
	**w = *i;
}

void bar5(int ***w) {
	int *i;
	zob(&i);
	***w = *i;
}

void bar6(int ***w) {
	int *i;
	zob1(&i);
	***w = *i;
}

void bar7(int ****w) {
	int **i;
	zob1(&i);
	****w = **i;
}

int bar8(void) {
	int i;
	foo(&i);
	return i;
}

void not0(void) {
	int i;
	foo(&i);
}

void not1(void) {
	int i;
	foo(&i);
	i = 1;
}

/* XXX false positive */
void not2(void) {
	int i;
	foo(&i);
	*(&i) = 2;
}