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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/* $NetBSD: opt_lp.c,v 1.10 2023/06/09 06:36:58 rillig Exp $ */
/*
* Tests for the options '-lp' and '-nlp'.
*
* The option '-lp' lines up code surrounded by parentheses in continuation
* lines. With '-lp', if a line has a left parenthesis that is not closed on
* that line, continuation lines are lined up to start at the character
* position just after the left parenthesis.
*
* The option '-nlp' indents continuation lines with the continuation
* indentation; see '-ci'.
*/
//indent input
void
example(void)
{
p1 = first_procedure(second_procedure(p2, p3),
third_procedure(p4, p5));
p1 = first_procedure(second_procedure(p2,
p3),
third_procedure(p4,
p5));
p1 = first_procedure(
second_procedure(p2, p3),
third_procedure(p4, p5));
}
//indent end
//indent run -lp
void
example(void)
{
p1 = first_procedure(second_procedure(p2, p3),
third_procedure(p4, p5));
p1 = first_procedure(second_procedure(p2,
p3),
third_procedure(p4,
p5));
p1 = first_procedure(
second_procedure(p2, p3),
third_procedure(p4, p5));
}
//indent end
//indent run -nlp
void
example(void)
{
p1 = first_procedure(second_procedure(p2, p3),
third_procedure(p4, p5));
p1 = first_procedure(second_procedure(p2,
p3),
third_procedure(p4,
p5));
p1 = first_procedure(
second_procedure(p2, p3),
third_procedure(p4, p5));
}
//indent end
//indent run -nlp -ci4
void
example(void)
{
p1 = first_procedure(second_procedure(p2, p3),
third_procedure(p4, p5));
p1 = first_procedure(second_procedure(p2,
p3),
third_procedure(p4,
p5));
p1 = first_procedure(
second_procedure(p2, p3),
third_procedure(p4, p5));
}
//indent end
/*
* Ensure that in multi-line else-if conditions, all lines are indented by the
* correct amount. The 'else if' condition is tricky because it has the same
* indentation as the preceding 'if' condition.
*/
//indent input
{
if (cond11a
&& cond11b
&& cond11c) {
stmt11;
} else if (cond12a
&& cond12b
&& cond12c) {
stmt12;
}
}
{
if (cond21a
&& cond21b
&& cond21c)
stmt21;
else if (cond22a
&& cond22b
&& cond22c)
stmt22;
}
//indent end
//indent run -ci4 -nlp
{
if (cond11a
&& cond11b
&& cond11c) {
stmt11;
} else if (cond12a
&& cond12b
&& cond12c) {
stmt12;
}
}
{
if (cond21a
&& cond21b
&& cond21c)
stmt21;
else if (cond22a
&& cond22b
&& cond22c)
stmt22;
}
//indent end
|