blob: aaea5957ac4c7f0847edcf91b5783dcf53b0a0b5 (
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/* $NetBSD: opt_fc1.c,v 1.11 2023/05/14 17:53:38 rillig Exp $ */
/*
* Tests for the options '-fc1' and '-nfc1'.
*
* The option '-fc1' formats comments in column 1.
*
* The option '-nfc1' preserves the original formatting of comments that start
* in column 1.
*/
//indent input
/*
* A comment
* in column 1.
*
*
*
*/
//indent end
//indent run -fc1
/*
* A comment in column 1.
*
*
*
*/
//indent end
//indent run-equals-input -nfc1
//indent input
/* $ Neither indentation nor surrounding spaces. */
/*narrow*/
/* $ Indented by a single space, single spaces around the text. */
/* space */
/* $ Indented by a single tab, single tabs around the text. */
/* indented tab */
/* $ The second comment is moved to a separate line. */
/* col1 space-padded */ /* space-padded */
/* $ Both comment texts get surrounded by spaces. */
/*col1 no-padding*//*no-padding*/
//indent end
//indent run -fc1
/* $ The comment text got surrounded by spaces. */
/* narrow */
/* $ The indentation got removed. */
/* space */
/* $ The indentation got removed. */
/* indented tab */
/* $ Each comment got its separate line. */
/* col1 space-padded */
/* space-padded */
/* $ Both comment texts got surrounded by spaces. */
/* col1 no-padding */
/* no-padding */
//indent end
//indent run -nfc1
/* $ No spaces got added around the comment text. */
/*narrow*/
/* $ The indentation of a single space was preserved. */
/* $ If the comment were moved to column 1, it would change from the area */
/* $ of 'comments that may be formatted' to the area of 'comments that must */
/* $ not be formatted. The indentation of a single space prevents this. */
/* space */
/* $ The indentation was changed from a single tab to a single space. */
/* indented tab */
/* $ The second comment moved to a separate line. */
/* col1 space-padded */
/* space-padded */
/* $ The 'col1' comment starts in column 1 and is thus not modified. */
/* $ The second comment started further to the right and thus was modified */
/* $ by moving it to a separate line, but not to column 1. */
/*col1 no-padding*/
/* no-padding */
//indent end
/*
* Since 2019-04-04 and before pr_comment.c 1.123 from 2021-11-25, the
* function analyze_comment wrongly joined the two comments.
*/
//indent input
/*
* A multi-line comment that starts
* in column 1.
*//* followed by another multi-line comment
* that starts in column 4.
*/
//indent end
//indent run -fc1
/*
* A multi-line comment that starts in column 1.
*/
/*
* followed by another multi-line comment that starts in column 4.
*/
//indent end
//indent run -nfc1
/*
* A multi-line comment that starts
* in column 1.
*/
/*
* followed by another multi-line comment that starts in column 4.
*/
//indent end
//indent input
/* comment */ int decl2; /* comment */
/* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
/* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong second comment */
//indent end
//indent run -fc1
/* comment */ int decl2; /* comment */
/* looooooooooooooooooooooooooooooooooooooooong first comment */ int decl2; /* second comment */
/* first comment */ int decl2; /* looooooooooooooooooooooooooooooooooooooooong
* second comment */
//indent end
//indent run-equals-prev-output -nfc1
|