blob: 55f01931dbf4f61fe172c5bf60f10b1568c54b5d (
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
/* $NetBSD: opt_bs.c,v 1.10 2022/04/24 09:04:12 rillig Exp $ */
/*
* Tests for the options '-bs' and '-nbs' ("blank after sizeof").
*
* The option '-bs' forces a space after the keyword 'sizeof'.
*
* The option '-nbs' removes horizontal whitespace after the keyword 'sizeof',
* unless the next token is a word as well.
*/
//indent input
void
example(int i)
{
print(sizeof(i));
print(sizeof(int));
print(sizeof i);
print(sizeof (i));
print(sizeof (int));
print(sizeof i);
print(sizeof (i));
print(sizeof (int));
}
//indent end
//indent run -bs
void
example(int i)
{
print(sizeof (i));
print(sizeof (int));
print(sizeof i);
print(sizeof (i));
print(sizeof (int));
print(sizeof i);
print(sizeof (i));
print(sizeof (int));
}
//indent end
//indent run -nbs
void
example(int i)
{
print(sizeof(i));
print(sizeof(int));
print(sizeof i);
print(sizeof(i));
print(sizeof(int));
print(sizeof i);
print(sizeof(i));
print(sizeof(int));
}
//indent end
/*
* The option '-bs' only affects 'sizeof', not 'offsetof', even though these
* two keywords are syntactically similar.
*/
//indent input
int sizeof_type = sizeof (int);
int sizeof_type = sizeof(int);
int sizeof_expr = sizeof (0);
int sizeof_expr = sizeof(0);
int sizeof_expr = sizeof 0;
int offset = offsetof(struct s, member);
int offset = offsetof (struct s, member);
//indent end
//indent run -pcs -di0
int sizeof_type = sizeof (int);
int sizeof_type = sizeof (int);
int sizeof_expr = sizeof (0);
int sizeof_expr = sizeof (0);
int sizeof_expr = sizeof 0;
int offset = offsetof (struct s, member);
int offset = offsetof (struct s, member);
//indent end
//indent run -npcs -di0
int sizeof_type = sizeof(int);
int sizeof_type = sizeof(int);
int sizeof_expr = sizeof(0);
int sizeof_expr = sizeof(0);
int sizeof_expr = sizeof 0;
int offset = offsetof(struct s, member);
int offset = offsetof(struct s, member);
//indent end
/* Ensure that there is no blank before 'sizeof(' if there is a '\n' between. */
//indent input
int sizeof_newline = sizeof
(0);
//indent end
//indent run-equals-input -di0 -bs
//indent run-equals-input -di0 -nbs
/* Ensure that only the first '(' after 'sizeof' gets a blank. */
//indent input
int sizeof_parenthesized = sizeof((0));
//indent end
//indent run -di0 -bs
int sizeof_parenthesized = sizeof ((0));
//indent end
//indent run-equals-input -di0 -nbs
|