summaryrefslogtreecommitdiff
path: root/tests/usr.bin/indent/lsym_type.c
blob: 0a7a899aac53f2237ec7b4746ae7aedfbcef49e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/* $NetBSD: lsym_type.c,v 1.1 2023/06/16 23:51:32 rillig Exp $ */

/*
 * Tests for the token lsym_type, which represents a type name in the following
 * contexts:
 *
 * In a declaration that is not for a function.
 *
 * As part of a parameter list of a function prototype.
 *
 * In a cast expression.
 *
 * In a compound expression (since C99).
 *
 * See also:
 *	fmt_decl
 *	lex_ident
 *	lsym_word
 *	opt_ta
 *	opt_T
 */

/*
 * Indent has to guess which identifiers are types and which are variables.
 */
//indent input
t1		       *no_init_ptr;
t2		       *init_ptr = 0;
const t3	       *const_no_init_ptr;
static t4	       *static_no_init_ptr;
typedef t5 *typedef_no_init_ptr;

// $ XXX: There's no point aligning the word 'const' with the other names.
const char	       *const names[3];
//indent end

//indent run-equals-input -di24


//indent input
{
{}
size_t hello;
}
//indent end

//indent run
{
	{
	}
	size_t		hello;
}
//indent end


/*
 * In a sizeof expression, a type argument must be enclosed in parentheses.
 */
//indent input
int sizeof_int = sizeof int;
//indent end

//indent run-equals-input -di0