Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint/lint1 lint: allow _Bool for bit-fields



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

description:
lint: allow _Bool for bit-fields

diffstat:

 tests/usr.bin/xlint/lint1/msg_035.c   |  4 ++--
 tests/usr.bin/xlint/lint1/msg_035.exp |  1 -
 usr.bin/xlint/lint1/decl.c            |  6 +++---
 3 files changed, 5 insertions(+), 6 deletions(-)

diffs (53 lines):

diff -r fbf7c3e6d42b -r ce6c9269930c tests/usr.bin/xlint/lint1/msg_035.c
--- a/tests/usr.bin/xlint/lint1/msg_035.c       Sat Jan 02 16:12:39 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.c       Sat Jan 02 16:33:39 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_035.c,v 1.3 2021/01/02 16:12:39 rillig Exp $       */
+/*     $NetBSD: msg_035.c,v 1.4 2021/01/02 16:33:39 rillig Exp $       */
 # 3 "msg_035.c"
 
 // Test for message: illegal bit-field type [35]
@@ -30,7 +30,7 @@
 struct example {
        signed signed_flag: 1;
        unsigned unsigned_flag: 1;
-       _Bool boolean_flag: 1;          // FIXME: allowed since C99 6.7.2.1p5
+       _Bool boolean_flag: 1;
        char char_flag: 1;
        signed char signed_char_flag: 1;
        unsigned char unsigned_char_flag: 1;
diff -r fbf7c3e6d42b -r ce6c9269930c tests/usr.bin/xlint/lint1/msg_035.exp
--- a/tests/usr.bin/xlint/lint1/msg_035.exp     Sat Jan 02 16:12:39 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_035.exp     Sat Jan 02 16:33:39 2021 +0000
@@ -1,4 +1,3 @@
-msg_035.c(33): warning: illegal bit-field type [35]
 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]
diff -r fbf7c3e6d42b -r ce6c9269930c usr.bin/xlint/lint1/decl.c
--- a/usr.bin/xlint/lint1/decl.c        Sat Jan 02 16:12:39 2021 +0000
+++ b/usr.bin/xlint/lint1/decl.c        Sat Jan 02 16:33:39 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.98 2021/01/02 03:49:25 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.99 2021/01/02 16:33:39 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: decl.c,v 1.98 2021/01/02 03:49:25 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.99 2021/01/02 16:33:39 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -1118,7 +1118,7 @@
                                /* nonportable bit-field type */
                                warning(34);
                        }
-               } else if (t != INT && t != UINT) {
+               } else if (t != INT && t != UINT && t != BOOL) {
                        /*
                         * Non-integer types are always illegal for
                         * bitfields, regardless of BITFIELDTYPE.



Home | Main Index | Thread Index | Old Index