xref: /netbsd-src/tests/usr.bin/indent/lsym_semicolon.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /* $NetBSD: lsym_semicolon.c,v 1.4 2022/04/24 10:36:37 rillig Exp $ */
2 
3 /*
4  * Tests for the token lsym_semicolon, which represents ';' in these contexts:
5  *
6  * In a declaration, ';' finishes the declaration.
7  *
8  * In a statement, ';' finishes the statement.
9  *
10  * In a 'for' statement, ';' separates the 3 expressions in the head of the
11  * 'for' statement.
12  */
13 
14 //indent input
15 struct {
16 	int member;
17 } global_var;
18 //indent end
19 
20 //indent run-equals-input -di0
21 
22 
23 //indent input
24 void
25 function(void)
26 {
27 	for ( ; ; )
28 		stmt();
29 	for (;;)
30 		stmt();
31 }
32 //indent end
33 
34 //indent run
35 void
36 function(void)
37 {
38 	for (;;)
39 		stmt();
40 	for (;;)
41 		stmt();
42 }
43 //indent end
44