1 /* $NetBSD: opt_cdb.c,v 1.10 2023/06/09 07:18:52 rillig Exp $ */ 2 3 /* 4 * Tests for the options '-cdb' and '-ncdb'. 5 * 6 * The option '-cdb' forces the comment delimiter '/' '*' and '*' '/' to be on 7 * a separate line. This only affects block comments, but not comments to the 8 * right of the code. 9 * 10 * The option '-ncdb' preserves comments with delimiters. 11 */ 12 13 //indent input 14 /* A single line without delimiters. */ 15 16 /* Multiple 17 * lines 18 * without delimiters. */ 19 20 /* 21 * A single line with delimiters. 22 */ 23 24 /* 25 * Multiple 26 * lines 27 * with delimiters. 28 */ 29 //indent end 30 31 //indent run -cdb 32 /* A single line without delimiters. */ 33 34 /* 35 * Multiple lines without delimiters. 36 */ 37 38 /* 39 * A single line with delimiters. 40 */ 41 42 /* 43 * Multiple lines with delimiters. 44 */ 45 //indent end 46 47 //indent run -ncdb 48 /* A single line without delimiters. */ 49 50 /* Multiple lines without delimiters. */ 51 52 /* 53 * A single line with delimiters. 54 */ 55 56 /* 57 * Multiple lines with delimiters. 58 */ 59 //indent end 60 61 62 /* 63 * Code comments on global declarations. 64 */ 65 //indent input 66 int global_single_without; /* A single line without delimiters. */ 67 68 int global_multi_without; /* 69 * Multiple lines without delimiters. 70 */ 71 72 int global_single_with; /* 73 * A single line with delimiters. 74 */ 75 76 int global_single_with; /* 77 * Multiple 78 * lines 79 * with delimiters. 80 */ 81 //indent end 82 83 //indent run -di0 -cdb 84 int global_single_without; /* A single line without delimiters. */ 85 86 int global_multi_without; /* Multiple lines without delimiters. */ 87 88 int global_single_with; /* A single line with delimiters. */ 89 90 int global_single_with; /* Multiple lines with delimiters. */ 91 //indent end 92 93 //indent run-equals-prev-output -di0 -ncdb 94 95 96 /* 97 * Block comments that are inside a function. 98 */ 99 //indent input 100 void example(void)101example(void) 102 { 103 /* A single line without delimiters. */ 104 int local_single_without; 105 106 /* Multiple 107 * lines 108 * without delimiters. */ 109 int local_multi_without; 110 111 /* 112 * A single line with delimiters. 113 */ 114 int local_single_with; 115 116 /* 117 * Multiple 118 * lines 119 * with delimiters. 120 */ 121 int local_multi_with; 122 } 123 //indent end 124 125 //indent run -di0 -cdb 126 void example(void)127example(void) 128 { 129 /* A single line without delimiters. */ 130 int local_single_without; 131 132 /* 133 * Multiple lines without delimiters. 134 */ 135 int local_multi_without; 136 137 /* 138 * A single line with delimiters. 139 */ 140 int local_single_with; 141 142 /* 143 * Multiple lines with delimiters. 144 */ 145 int local_multi_with; 146 } 147 //indent end 148 149 //indent run -di0 -ncdb 150 void example(void)151example(void) 152 { 153 /* A single line without delimiters. */ 154 int local_single_without; 155 156 /* Multiple lines without delimiters. */ 157 int local_multi_without; 158 159 /* 160 * A single line with delimiters. 161 */ 162 int local_single_with; 163 164 /* 165 * Multiple lines with delimiters. 166 */ 167 int local_multi_with; 168 } 169 //indent end 170 171 172 //indent input 173 /* 174 175 */ 176 //indent end 177 178 //indent run -cdb 179 /* 180 * 181 */ 182 //indent end 183 184 //indent run-equals-prev-output -ncdb 185 186 187 //indent input 188 /* 189 190 */ 191 //indent end 192 193 //indent run -cdb 194 /* 195 * 196 */ 197 //indent end 198 199 //indent run-equals-prev-output -ncdb 200 201 202 /* 203 * Between 2019-04-04 and 2023-06-09, the -ncdb option condensed multi-line 204 * comments as well, not only single-line comments. 205 */ 206 //indent input 207 { 208 /* 209 * This is the first paragraph. 210 * 211 * This is the second paragraph. 212 */ 213 } 214 //indent end 215 216 //indent run-equals-input -cdb 217 218 //indent run-equals-input -ncdb 219