tests/lint: remove outdated commentsdiff -r1.24 -r1.25 src/tests/usr.bin/xlint/lint1/d_c99_init.c
(rillig)
--- src/tests/usr.bin/xlint/lint1/d_c99_init.c 2021/03/30 14:25:28 1.24
+++ src/tests/usr.bin/xlint/lint1/d_c99_init.c 2021/03/30 15:05:05 1.25
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: d_c99_init.c,v 1.24 2021/03/30 14:25:28 rillig Exp $ */ | 1 | /* $NetBSD: d_c99_init.c,v 1.25 2021/03/30 15:05:05 rillig Exp $ */ | |
2 | # 3 "d_c99_init.c" | 2 | # 3 "d_c99_init.c" | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Test C99 initializers. | 5 | * Test C99 initializers. | |
6 | * | 6 | * | |
7 | * See C99 6.7.8 "Initialization". | 7 | * See C99 6.7.8 "Initialization". | |
8 | */ | 8 | */ | |
9 | 9 | |||
10 | 10 | |||
11 | void use(const void *); | 11 | void use(const void *); | |
12 | 12 | |||
13 | typedef struct any { | 13 | typedef struct any { | |
14 | const void *value; | 14 | const void *value; | |
@@ -250,29 +250,28 @@ struct ten { | @@ -250,29 +250,28 @@ struct ten { | |||
250 | int i2; | 250 | int i2; | |
251 | int i3; | 251 | int i3; | |
252 | int i4; | 252 | int i4; | |
253 | int i5; | 253 | int i5; | |
254 | int i6; | 254 | int i6; | |
255 | int i7; | 255 | int i7; | |
256 | int i8; | 256 | int i8; | |
257 | int i9; | 257 | int i9; | |
258 | }; | 258 | }; | |
259 | 259 | |||
260 | struct ten ten = { | 260 | struct ten ten = { | |
261 | .i3 = 3, | 261 | .i3 = 3, | |
262 | 4, | 262 | 4, | |
263 | // FIXME: assertion "level->bl_type->t_tspec == ARRAY" failed in brace_level_extend_if_array_of_unknown_size | 263 | 5, | |
264 | // 5, | 264 | 6, | |
265 | // 6, | |||
266 | }; | 265 | }; | |
267 | 266 | |||
268 | int c99_6_7_8_p26_example3[4][3] = { | 267 | int c99_6_7_8_p26_example3[4][3] = { | |
269 | { 1, 3, 5 }, | 268 | { 1, 3, 5 }, | |
270 | { 2, 4, 6 }, | 269 | { 2, 4, 6 }, | |
271 | { 3, 5, 7 }, | 270 | { 3, 5, 7 }, | |
272 | }; | 271 | }; | |
273 | 272 | |||
274 | int c99_6_7_8_p27_example4[4][3] = { | 273 | int c99_6_7_8_p27_example4[4][3] = { | |
275 | { 1 }, { 2 }, { 3 }, { 4 } | 274 | { 1 }, { 2 }, { 3 }, { 4 } | |
276 | }; | 275 | }; | |
277 | 276 | |||
278 | struct { | 277 | struct { | |
@@ -320,58 +319,55 @@ ensure_array_type_is_not_modified_during | @@ -320,58 +319,55 @@ ensure_array_type_is_not_modified_during | |||
320 | array_of_unknown_size a1 = { 1, 2, 3}; | 319 | array_of_unknown_size a1 = { 1, 2, 3}; | |
321 | 320 | |||
322 | switch (4) { | 321 | switch (4) { | |
323 | case sizeof(array_of_unknown_size): | 322 | case sizeof(array_of_unknown_size): | |
324 | case 0: /* expect: duplicate case in switch: 0 */ | 323 | case 0: /* expect: duplicate case in switch: 0 */ | |
325 | case 3: | 324 | case 3: | |
326 | case 4: | 325 | case 4: | |
327 | case 12: | 326 | case 12: | |
328 | break; | 327 | break; | |
329 | } | 328 | } | |
330 | } | 329 | } | |
331 | 330 | |||
332 | struct point unknown_member_name_beginning = { | 331 | struct point unknown_member_name_beginning = { | |
333 | /* TODO: remove me */ | |||
334 | .r = 5, /* expect: undefined struct/union member: r */ | 332 | .r = 5, /* expect: undefined struct/union member: r */ | |
335 | .x = 4, | 333 | .x = 4, | |
336 | .y = 3, | 334 | .y = 3, | |
337 | }; | 335 | }; | |
338 | 336 | |||
339 | struct point unknown_member_name_middle = { | 337 | struct point unknown_member_name_middle = { | |
340 | .x = 4, | 338 | .x = 4, | |
341 | .r = 5, /* expect: undefined struct/union member: r */ | 339 | .r = 5, /* expect: undefined struct/union member: r */ | |
342 | .y = 3, | 340 | .y = 3, | |
343 | }; | 341 | }; | |
344 | 342 | |||
345 | struct point unknown_member_name_end = { | 343 | struct point unknown_member_name_end = { | |
346 | .x = 4, | 344 | .x = 4, | |
347 | .y = 3, | 345 | .y = 3, | |
348 | .r = 5, /* expect: undefined struct/union member: r */ | 346 | .r = 5, /* expect: undefined struct/union member: r */ | |
349 | }; | 347 | }; | |
350 | 348 | |||
351 | union value { | 349 | union value { | |
352 | int int_value; | 350 | int int_value; | |
353 | void *pointer_value; | 351 | void *pointer_value; | |
354 | }; | 352 | }; | |
355 | 353 | |||
356 | union value unknown_union_member_name_first = { | 354 | union value unknown_union_member_name_first = { | |
357 | /* TODO: remove me */ | |||
358 | .unknown_value = 4, /* expect: undefined struct/union member */ | 355 | .unknown_value = 4, /* expect: undefined struct/union member */ | |
359 | .int_value = 3, | 356 | .int_value = 3, | |
360 | }; | 357 | }; | |
361 | 358 | |||
362 | union value unknown_union_member_name_second = { | 359 | union value unknown_union_member_name_second = { | |
363 | .int_value = 3, | 360 | .int_value = 3, | |
364 | /* TODO: remove me */ | |||
365 | .unknown_value = 4, /* expect: undefined struct/union member */ | 361 | .unknown_value = 4, /* expect: undefined struct/union member */ | |
366 | }; | 362 | }; | |
367 | 363 | |||
368 | struct point designators_with_subscript = { | 364 | struct point designators_with_subscript = { | |
369 | [0] = 3, /* expect: only for arrays */ | 365 | [0] = 3, /* expect: only for arrays */ | |
370 | .member[0][0].member = 4, /* expect: undefined struct/union member */ | 366 | .member[0][0].member = 4, /* expect: undefined struct/union member */ | |
371 | .x.y.z = 5, /* intentionally not caught, see designator_look_up */ | 367 | .x.y.z = 5, /* intentionally not caught, see designator_look_up */ | |
372 | }; | 368 | }; | |
373 | 369 | |||
374 | struct { | 370 | struct { | |
375 | int : 16; | 371 | int : 16; | |
376 | } struct_with_only_unnamed_members = { /* expect: has no named members */ | 372 | } struct_with_only_unnamed_members = { /* expect: has no named members */ | |
377 | 123, /* expect: too many struct/union initializers */ | 373 | 123, /* expect: too many struct/union initializers */ |
--- src/tests/usr.bin/xlint/lint1/Attic/d_c99_init.exp 2021/03/30 14:25:28 1.17
+++ src/tests/usr.bin/xlint/lint1/Attic/d_c99_init.exp 2021/03/30 15:05:05 1.18
@@ -1,21 +1,21 @@ | @@ -1,21 +1,21 @@ | |||
1 | d_c99_init.c(23): error: too many initializers [174] | 1 | d_c99_init.c(23): error: too many initializers [174] | |
2 | d_c99_init.c(63): error: cannot initialize 'pointer to const void' from 'struct any' [185] | 2 | d_c99_init.c(63): error: cannot initialize 'pointer to const void' from 'struct any' [185] | |
3 | d_c99_init.c(80): error: too many array initializers, expected 3 [173] | 3 | d_c99_init.c(80): error: too many array initializers, expected 3 [173] | |
4 | d_c99_init.c(139): error: too many struct/union initializers [172] | 4 | d_c99_init.c(139): error: too many struct/union initializers [172] | |
5 | d_c99_init.c(145): error: syntax error 'named member must only be used with struct/union' [249] | 5 | d_c99_init.c(145): error: syntax error 'named member must only be used with struct/union' [249] | |
6 | d_c99_init.c(232): error: too many struct/union initializers [172] | 6 | d_c99_init.c(232): error: too many struct/union initializers [172] | |
7 | d_c99_init.c(238): warning: illegal combination of integer (char) and pointer (pointer to char) [183] | 7 | d_c99_init.c(238): warning: illegal combination of integer (char) and pointer (pointer to char) [183] | |
8 | d_c99_init.c(242): warning: illegal combination of integer (char) and pointer (pointer to char) [183] | 8 | d_c99_init.c(242): warning: illegal combination of integer (char) and pointer (pointer to char) [183] | |
9 | d_c99_init.c(282): error: cannot initialize 'struct <unnamed>' from 'int' [185] | 9 | d_c99_init.c(281): error: cannot initialize 'struct <unnamed>' from 'int' [185] | |
10 | d_c99_init.c(324): error: duplicate case in switch: 0 [199] | 10 | d_c99_init.c(323): error: duplicate case in switch: 0 [199] | |
11 | d_c99_init.c(334): error: undefined struct/union member: r [101] | 11 | d_c99_init.c(332): error: undefined struct/union member: r [101] | |
12 | d_c99_init.c(341): error: undefined struct/union member: r [101] | 12 | d_c99_init.c(339): error: undefined struct/union member: r [101] | |
13 | d_c99_init.c(348): error: undefined struct/union member: r [101] | 13 | d_c99_init.c(346): error: undefined struct/union member: r [101] | |
14 | d_c99_init.c(358): error: undefined struct/union member: unknown_value [101] | 14 | d_c99_init.c(355): error: undefined struct/union member: unknown_value [101] | |
15 | d_c99_init.c(365): error: undefined struct/union member: unknown_value [101] | 15 | d_c99_init.c(361): error: undefined struct/union member: unknown_value [101] | |
16 | d_c99_init.c(369): error: syntax error 'designator '[...]' is only for arrays' [249] | 16 | d_c99_init.c(365): error: syntax error 'designator '[...]' is only for arrays' [249] | |
17 | d_c99_init.c(370): error: undefined struct/union member: member [101] | 17 | d_c99_init.c(366): error: undefined struct/union member: member [101] | |
18 | d_c99_init.c(376): warning: structure has no named members [65] | 18 | d_c99_init.c(372): warning: structure has no named members [65] | |
19 | d_c99_init.c(377): error: too many struct/union initializers [172] | 19 | d_c99_init.c(373): error: too many struct/union initializers [172] | |
20 | d_c99_init.c(382): warning: union has no named members [65] | 20 | d_c99_init.c(378): warning: union has no named members [65] | |
21 | d_c99_init.c(383): error: too many struct/union initializers [172] | 21 | d_c99_init.c(379): error: too many struct/union initializers [172] |
--- src/tests/usr.bin/xlint/lint1/msg_247.c 2021/03/26 16:59:19 1.7
+++ src/tests/usr.bin/xlint/lint1/msg_247.c 2021/03/30 15:05:05 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: msg_247.c,v 1.7 2021/03/26 16:59:19 rillig Exp $ */ | 1 | /* $NetBSD: msg_247.c,v 1.8 2021/03/30 15:05:05 rillig Exp $ */ | |
2 | # 3 "msg_247.c" | 2 | # 3 "msg_247.c" | |
3 | 3 | |||
4 | // Test for message: pointer cast from '%s' to '%s' may be troublesome [247] | 4 | // Test for message: pointer cast from '%s' to '%s' may be troublesome [247] | |
5 | 5 | |||
6 | /* lint1-extra-flags: -c */ | 6 | /* lint1-extra-flags: -c */ | |
7 | 7 | |||
8 | /* example taken from Xlib.h */ | 8 | /* example taken from Xlib.h */ | |
9 | typedef struct { | 9 | typedef struct { | |
10 | int id; | 10 | int id; | |
11 | } *PDisplay; | 11 | } *PDisplay; | |
12 | 12 | |||
13 | struct Other { | 13 | struct Other { | |
14 | int id; | 14 | int id; | |
@@ -30,27 +30,27 @@ example(struct Other *arg) | @@ -30,27 +30,27 @@ example(struct Other *arg) | |||
30 | */ | 30 | */ | |
31 | display = (PDisplay)arg; /* expect: 247 */ | 31 | display = (PDisplay)arg; /* expect: 247 */ | |
32 | } | 32 | } | |
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * C code with a long history that has existed in pre-C90 times already often | 35 | * C code with a long history that has existed in pre-C90 times already often | |
36 | * uses 'pointer to char' where modern code would use 'pointer to void'. | 36 | * uses 'pointer to char' where modern code would use 'pointer to void'. | |
37 | * Since 'char' is the most general underlying type, there is nothing wrong | 37 | * Since 'char' is the most general underlying type, there is nothing wrong | |
38 | * with casting to it. An example for this type of code is X11. | 38 | * with casting to it. An example for this type of code is X11. | |
39 | * | 39 | * | |
40 | * Casting to 'pointer to char' may also be used by programmers who don't know | 40 | * Casting to 'pointer to char' may also be used by programmers who don't know | |
41 | * about endianness, but that's not something lint can do anything about. The | 41 | * about endianness, but that's not something lint can do anything about. The | |
42 | * code for these two use cases looks exactly the same, so lint errs on the | 42 | * code for these two use cases looks exactly the same, so lint errs on the | |
43 | * side of fewer false positive warnings here. (after fixing the FIXME below) | 43 | * side of fewer false positive warnings here. | |
44 | */ | 44 | */ | |
45 | char * | 45 | char * | |
46 | cast_to_char_pointer(struct Other *arg) | 46 | cast_to_char_pointer(struct Other *arg) | |
47 | { | 47 | { | |
48 | return (char *)arg; | 48 | return (char *)arg; | |
49 | } | 49 | } | |
50 | 50 | |||
51 | /* | 51 | /* | |
52 | * In traditional C there was 'unsigned char' as well, so the same reasoning | 52 | * In traditional C there was 'unsigned char' as well, so the same reasoning | |
53 | * as for plain 'char' applies here. | 53 | * as for plain 'char' applies here. | |
54 | */ | 54 | */ | |
55 | unsigned char * | 55 | unsigned char * | |
56 | cast_to_unsigned_char_pointer(struct Other *arg) | 56 | cast_to_unsigned_char_pointer(struct Other *arg) |