xref: /netbsd-src/tests/usr.bin/indent/lsym_type.c (revision abc3274d3a58885e4acbaa1be9def415f1e99b99)
1 /* $NetBSD: lsym_type.c,v 1.1 2023/06/16 23:51:32 rillig Exp $ */
2 
3 /*
4  * Tests for the token lsym_type, which represents a type name in the following
5  * contexts:
6  *
7  * In a declaration that is not for a function.
8  *
9  * As part of a parameter list of a function prototype.
10  *
11  * In a cast expression.
12  *
13  * In a compound expression (since C99).
14  *
15  * See also:
16  *	fmt_decl
17  *	lex_ident
18  *	lsym_word
19  *	opt_ta
20  *	opt_T
21  */
22 
23 /*
24  * Indent has to guess which identifiers are types and which are variables.
25  */
26 //indent input
27 t1		       *no_init_ptr;
28 t2		       *init_ptr = 0;
29 const t3	       *const_no_init_ptr;
30 static t4	       *static_no_init_ptr;
31 typedef t5 *typedef_no_init_ptr;
32 
33 // $ XXX: There's no point aligning the word 'const' with the other names.
34 const char	       *const names[3];
35 //indent end
36 
37 //indent run-equals-input -di24
38 
39 
40 //indent input
41 {
42 {}
43 size_t hello;
44 }
45 //indent end
46 
47 //indent run
48 {
49 	{
50 	}
51 	size_t		hello;
52 }
53 //indent end
54 
55 
56 /*
57  * In a sizeof expression, a type argument must be enclosed in parentheses.
58  */
59 //indent input
60 int sizeof_int = sizeof int;
61 //indent end
62 
63 //indent run-equals-input -di0
64