xref: /netbsd-src/tests/usr.bin/indent/opt_T.c (revision 65e3242c1e7ce8e4fda93bdaae8c93d7270ffe07)
1 /* $NetBSD: opt_T.c,v 1.5 2023/06/17 22:09:24 rillig Exp $ */
2 
3 /*
4  * Tests for the option '-T', which specifies a single identifier that indent
5  * will recognize as a type name.  This affects the formatting of
6  * syntactically ambiguous expressions that could be casts or multiplications,
7  * among others.
8  */
9 
10 //indent input
11 int cast = (custom_type_name)   *   arg;
12 
13 int mult = (unknown_type_name)   *   arg;
14 
15 /* See the option -ta for handling these types. */
16 int suff = (unknown_type_name_t)   *   arg;
17 //indent end
18 
19 //indent run -Tcustom_type_name -di0
20 int cast = (custom_type_name)*arg;
21 
22 int mult = (unknown_type_name) * arg;
23 
24 /* See the option -ta for handling these types. */
25 int suff = (unknown_type_name_t) * arg;
26 //indent end
27 
28 //indent run -Tcustom_type_name -di0 -cs
29 int cast = (custom_type_name) *arg;
30 
31 int mult = (unknown_type_name) * arg;
32 
33 /* See the option -ta for handling these types. */
34 int suff = (unknown_type_name_t) * arg;
35 //indent end
36 
37 
38 /*
39  * The keyword table has precedence over the custom-specified types; otherwise,
40  * the following lines would be declarations, and the declarators would be
41  * indented by 16.
42  */
43 //indent input
44 {
45 	break x;
46 	continue x;
47 	goto x;
48 	return x;
49 }
50 //indent end
51 
52 //indent run-equals-input -Tbreak -Tcontinue -Tgoto -Treturn
53