blob: 98affb3858e6164a22f4847b980a6e356b2dc059 (
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
/* $NetBSD: opt_ldi.c,v 1.5 2022/04/24 09:04:12 rillig Exp $ */
/*
* Tests for the option '-ldi', which specifies where the variable names of
* locally declared variables are placed.
*
* See also:
* opt_di.c
*/
//indent input
int global;
void
function(void)
{
int local;
}
//indent end
//indent run -ldi0
int global;
void
function(void)
{
int local;
}
//indent end
//indent run -ldi8
int global;
void
function(void)
{
int local;
}
//indent end
//indent run -ldi24
int global;
void
function(void)
{
int local;
}
//indent end
/*
* A variable that has an ad-hoc struct/union/enum type does not need to be
* indented to the right of the keyword 'struct', it only needs a single space
* of indentation.
*
* Before NetBSD indent.c 1.151 from 2021-10-24, the indentation depended on
* the length of the keyword 'struct', 'union' or 'enum', together with type
* qualifiers like 'const' or the storage class like 'static'.
*/
//indent input
{
struct {
int member;
} var = {
3,
};
}
//indent end
/*
* Struct members use '-di' for indentation, no matter whether they are
* declared globally or locally.
*/
//indent run -ldi0
{
struct {
int member;
} var = {
3,
};
}
//indent end
//indent run -ldi16
{
struct {
int member;
} var = {
3,
};
}
//indent end
|