Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/usr.bin/xlint/lint1 lint: fix and document test for il...



details:   https://anonhg.NetBSD.org/src/rev/fbf7c3e6d42b
branches:  trunk
changeset: 1017635:fbf7c3e6d42b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 02 16:12:39 2021 +0000

description:
lint: fix and document test for illegal bit-fields

The _Complex bit-field should have been commented out.

diffstat:

 tests/usr.bin/xlint/lint1/msg_035.c   |  12 ++++++++++--
 tests/usr.bin/xlint/lint1/msg_035.exp |  24 ++++++++++++------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diffs (64 lines):

diff -r 54e08d577377 -r fbf7c3e6d42b tests/usr.bin/xlint/lint1/msg_035.c
--- a/tests/usr.bin/xlint/lint1/msg_035.c       Sat Jan 02 15:55:54 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.c       Sat Jan 02 16:12:39 2021 +0000
@@ -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 @@
        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;
diff -r 54e08d577377 -r fbf7c3e6d42b tests/usr.bin/xlint/lint1/msg_035.exp
--- a/tests/usr.bin/xlint/lint1/msg_035.exp     Sat Jan 02 15:55:54 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.exp     Sat Jan 02 16:12:39 2021 +0000
@@ -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]



Home | Main Index | Thread Index | Old Index