opt_bacc.c revision 1.1
1/* $NetBSD: opt_bacc.c,v 1.1 2021/10/16 03:20:13 rillig Exp $ */
2/* $FreeBSD$ */
3
4#indent input
5/*
6 * Test the option -bacc, which forces a blank line around every conditional
7 * compilation block.  For example, in front of every #ifdef and after every
8 * #endif.  Other blank lines surrounding such blocks are swallowed.
9 *
10 * XXX: As of 2021-10-05, the option -bacc has no effect on declarations since
11 * process_decl resets prefix_blankline_requested unconditionally.
12 */
13
14int		a;
15#if 0				/* FIXME: need blank line above */
16int		b;
17#endif				/* FIXME: need blank line below */
18int		c;
19
20
21int		space_a;
22
23#if 0				/* FIXME: need blank line above */
24
25int		space_b;	/* FIXME: need no blank line above */
26
27#endif
28
29int		space_c;
30
31const char *
32os_name(void)
33{
34#if defined(__NetBSD__) || defined(__FreeBSD__)
35	return "BSD";
36#else
37	return "unknown";
38#endif
39}
40#indent end
41
42#indent run -bacc
43/*
44 * Test the option -bacc, which forces a blank line around every conditional
45 * compilation block.  For example, in front of every #ifdef and after every
46 * #endif.  Other blank lines surrounding such blocks are swallowed.
47 *
48 * XXX: As of 2021-10-05, the option -bacc has no effect on declarations since
49 * process_decl resets prefix_blankline_requested unconditionally.
50 */
51
52int		a;
53#if 0				/* FIXME: need blank line above */
54int		b;
55#endif				/* FIXME: need blank line below */
56int		c;
57
58
59int		space_a;
60#if 0				/* FIXME: need blank line above */
61
62int		space_b;	/* FIXME: need no blank line above */
63#endif
64
65int		space_c;
66
67/* $ XXX: The '*' should not be set apart from the rest of the return type. */
68const char     *
69os_name(void)
70{
71#if defined(__NetBSD__) || defined(__FreeBSD__)
72
73/* $ FIXME: This empty line _below_ the '#if' contradicts the manual page. */
74	return "BSD";
75#else
76
77/* $ FIXME: This empty line _below_ the '#else' contradicts the manual page. */
78	return "unknown";
79#endif
80/* $ FIXME: There should be an empty line after the '#endif'. */
81}
82#indent end
83
84#indent input
85int		a;
86#if 0
87int		b;
88#endif
89int		c;
90
91
92int		space_a;
93
94#if 0
95
96int		space_b;
97
98#endif
99
100int		space_c;
101
102const char *
103os_name(void)
104{
105#if defined(__NetBSD__) || defined(__FreeBSD__)
106	return "BSD";
107#else
108	return "unknown";
109#endif
110}
111#indent end
112
113#indent run -nbacc
114int		a;
115#if 0
116int		b;
117#endif
118int		c;
119
120
121int		space_a;
122
123#if 0
124
125int		space_b;
126
127#endif
128
129int		space_c;
130
131const char     *
132os_name(void)
133{
134#if defined(__NetBSD__) || defined(__FreeBSD__)
135	return "BSD";
136#else
137	return "unknown";
138#endif
139}
140#indent end
141