Module Name: src Committed By: rillig Date: Sat Jan 2 16:12:39 UTC 2021
Modified Files: src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp Log Message: lint: fix and document test for illegal bit-fields The _Complex bit-field should have been commented out. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_035.c \ src/tests/usr.bin/xlint/lint1/msg_035.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/xlint/lint1/msg_035.c diff -u src/tests/usr.bin/xlint/lint1/msg_035.c:1.2 src/tests/usr.bin/xlint/lint1/msg_035.c:1.3 --- src/tests/usr.bin/xlint/lint1/msg_035.c:1.2 Sat Jan 2 15:55:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.c Sat Jan 2 16:12:39 2021 @@ -1,8 +1,17 @@ -/* $NetBSD: msg_035.c,v 1.2 2021/01/02 15:55:54 rillig Exp $ */ +/* $NetBSD: msg_035.c,v 1.3 2021/01/02 16:12:39 rillig Exp $ */ # 3 "msg_035.c" // Test for message: illegal bit-field type [35] +/* + * In traditional C, only unsigned int is a portable bit-field type. + * + * In C89, only int, signed int and unsigned int are allowed (3.5.2.1p7). + * + * In C99 and C11, only _Bool, signed int and unsigned int are allowed, + * plus implementation-defined types (6.7.2.1p5). + */ + typedef struct { int dummy; } example_struct; @@ -46,7 +55,6 @@ struct example { unsigned int array_flag[4]: 1; example_function function_flag: 1; // FIXME: aborts: _Complex complex_flag: 1; - _Complex complex_flag: 1; float _Complex float_complex_flag: 1; double _Complex double_complex_flag: 1; long double _Complex long_double_complex_flag: 1; Index: src/tests/usr.bin/xlint/lint1/msg_035.exp diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.3 --- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.2 Sat Jan 2 15:55:54 2021 +++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sat Jan 2 16:12:39 2021 @@ -1,18 +1,18 @@ -msg_035.c(24): warning: illegal bit-field type [35] -msg_035.c(32): warning: illegal bit-field type [35] msg_035.c(33): warning: illegal bit-field type [35] -msg_035.c(34): warning: illegal bit-field type [35] -msg_035.c(35): warning: illegal bit-field type [35] -msg_035.c(38): warning: illegal bit-field type [35] -msg_035.c(39): warning: illegal bit-field type [35] -msg_035.c(40): warning: illegal bit-field type [35] -msg_035.c(41): void type for void_flag [19] -msg_035.c(41): zero size bit-field [37] +msg_035.c(41): warning: illegal bit-field type [35] msg_035.c(42): warning: illegal bit-field type [35] msg_035.c(43): warning: illegal bit-field type [35] -msg_035.c(45): warning: illegal bit-field type [35] -msg_035.c(46): warning: illegal bit-field type [35] +msg_035.c(44): warning: illegal bit-field type [35] msg_035.c(47): warning: illegal bit-field type [35] +msg_035.c(48): warning: illegal bit-field type [35] msg_035.c(49): warning: illegal bit-field type [35] -msg_035.c(50): warning: illegal bit-field type [35] +msg_035.c(50): void type for void_flag [19] +msg_035.c(50): zero size bit-field [37] msg_035.c(51): warning: illegal bit-field type [35] +msg_035.c(52): warning: illegal bit-field type [35] +msg_035.c(54): warning: illegal bit-field type [35] +msg_035.c(55): warning: illegal bit-field type [35] +msg_035.c(56): warning: illegal bit-field type [35] +msg_035.c(58): warning: illegal bit-field type [35] +msg_035.c(59): warning: illegal bit-field type [35] +msg_035.c(60): warning: illegal bit-field type [35]