opt_bap.c revision 1.9
1/* $NetBSD: opt_bap.c,v 1.9 2023/05/23 06:18:00 rillig Exp $ */
2
3/*
4 * Tests for the options '-bap' and '-nbap' ("blank line after procedure
5 * body").
6 *
7 * The option '-bap' forces a blank line after every function body.
8 *
9 * The option '-nbap' keeps everything as is.
10 */
11
12//indent input
13static void one_liner(void){}
14static void several_lines(void)
15{
16	action();
17}
18int main(void){}
19int global_variable;
20
21void already_has_blank_line_below(void)
22{
23}
24
25void has_several_blank_lines_below(void)
26{
27}
28
29
30
31int		the_end;
32//indent end
33
34//indent run -bap
35static void
36one_liner(void)
37{
38}
39
40static void
41several_lines(void)
42{
43	action();
44}
45
46int
47main(void)
48{
49}
50
51int		global_variable;
52
53void
54already_has_blank_line_below(void)
55{
56}
57
58void
59has_several_blank_lines_below(void)
60{
61}
62
63
64
65int		the_end;
66//indent end
67
68//indent run -nbap
69static void
70one_liner(void)
71{
72}
73static void
74several_lines(void)
75{
76	action();
77}
78int
79main(void)
80{
81}
82int		global_variable;
83
84void
85already_has_blank_line_below(void)
86{
87}
88
89void
90has_several_blank_lines_below(void)
91{
92}
93
94
95
96int		the_end;
97//indent end
98
99
100/*
101 * Don't insert a blank line between the end of a function body and an '#endif'
102 * line, as both are closing elements.
103 */
104//indent input
105#if 0
106void
107example(void)
108{
109}
110#endif
111//indent end
112
113//indent run-equals-input -bap
114
115
116//indent input
117#if 0
118void
119f(void)
120{
121}
122#else
123#endif
124//indent end
125
126//indent run -bacc -bap
127#if 0
128void
129f(void)
130{
131}
132// $ The following blank line may be considered optional, as it precedes a
133// $ preprocessing line.  In that case, the -bap option would only apply to
134// $ elements on the same syntactic level, such as function definitions and
135// $ other declarations.
136
137#else
138#endif
139//indent end
140