opt_sob.c revision 1.3
1/* $NetBSD: opt_sob.c,v 1.3 2021/10/16 21:32:10 rillig Exp $ */
2/* $FreeBSD$ */
3
4/*
5 * Tests for the options '-sob' and '-nsob'.
6 *
7 * The option '-sob' swallows optional blank lines.
8 *
9 * XXX: The manual page says: "You can use this to get rid of blank lines
10 * after declarations."; double check this.
11 *
12 * The option '-nsob' keeps optional blank lines as is.
13 */
14
15/*
16 * FIXME: There are lots of 'optional blank lines' here that should be
17 *  swallowed.
18 */
19#indent input
20void		function_declaration(void);
21
22
23int
24function_with_0_blank_lines(void)
25{
26	int		var;
27	var = value;
28	if (var > 0)
29		var--;
30	return var;
31}
32
33int
34function_with_1_blank_line(void)
35{
36
37	int		var;
38
39	var = value;
40
41	if (var > 0)
42/* $ The following line is "optional" and is removed due to '-sob'. */
43
44		var--;
45
46	return var;
47
48}
49
50
51int
52function_with_2_blank_lines(void)
53{
54
55
56	int		var;
57
58
59	var = value;
60
61
62	if (var > 0)
63/* $ The following 2 lines are "optional" and are removed due to '-sob'. */
64
65
66	    var--;
67
68
69	return var;
70
71
72}
73#indent end
74
75#indent run -sob
76void		function_declaration(void);
77
78
79int
80function_with_0_blank_lines(void)
81{
82	int		var;
83	var = value;
84	if (var > 0)
85		var--;
86	return var;
87}
88
89int
90function_with_1_blank_line(void)
91{
92
93	int		var;
94
95	var = value;
96
97	if (var > 0)
98		var--;
99
100	return var;
101
102}
103
104
105int
106function_with_2_blank_lines(void)
107{
108
109
110	int		var;
111
112
113	var = value;
114
115
116	if (var > 0)
117		var--;
118
119
120	return var;
121
122
123}
124#indent end
125
126#indent run -nsob
127void		function_declaration(void);
128
129
130int
131function_with_0_blank_lines(void)
132{
133	int		var;
134	var = value;
135	if (var > 0)
136		var--;
137	return var;
138}
139
140int
141function_with_1_blank_line(void)
142{
143
144	int		var;
145
146	var = value;
147
148	if (var > 0)
149
150		var--;
151
152	return var;
153
154}
155
156
157int
158function_with_2_blank_lines(void)
159{
160
161
162	int		var;
163
164
165	var = value;
166
167
168	if (var > 0)
169
170
171		var--;
172
173
174	return var;
175
176
177}
178#indent end
179