summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.78.1/tests/expected/c/00054-if_chain.c
blob: a6e0c561cb4f23683cb4fcaff05cb9d8adcebe33 (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
void foo(void)
{
	if (cond_a) {
		fcn_a();
		fcn_b();
	} else {
		fcn_c();
	}

	if (cond_b)
		fcn_d();
	else
		fcn_e();

	if (cond_c) {
		fcn_f();
		fcn_g();
	} else {
		fcn_h();
	}

	if (cond_d) {
		fcn_i();
	} else {
		fcn_j();
		fcn_k();
	}

	if (cond_e)
		fcn_l();
	else
		fcn_m();

	if (cond_f) {
		fcn_n();
	} else if (cond_g) {
		fcn_o();
		while (cond_g)
			fcn_p();
	} else if (cond_h) {
		while (cond_i) {
			fcn_q();
			fcn_r();
		}
	} else {
		fcn_s();
	}
}

/* this next bit test whether vbraces can be successfully converted
 * when the closing brace is in an #ifdef.
 * Note that the author should have braced the code to begin with.
 */
void bar(void)
{
	if (jiffies >= hw_priv->Counter[ port ].time) {
		hw_priv->Counter[ port ].fRead = 1;
		if (port == MAIN_PORT)
			hw_priv->Counter[ MAIN_PORT ].time = jiffies + HZ * 6;
		else
			hw_priv->Counter[ port ].time =

#ifdef SOME_DEFINE
				hw_priv->Counter[ port - 1 ].time + HZ * 2;

#else /* ifdef SOME_DEFINE */
				hw_priv->Counter[ MAIN_PORT ].time + HZ * 2;
#endif /* ifdef SOME_DEFINE */
	}
}

void funct(int v1, int v2, int v3)
{
	if (v1) {
		if (v2) f1();
	} else {
		if (v3) f2();
	}
}