Module Name: src
Committed By: rillig
Date: Sat Jan 2 16:33:39 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_035.c msg_035.exp
src/usr.bin/xlint/lint1: decl.c
Log Message:
lint: allow _Bool for bit-fields
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_035.c \
src/tests/usr.bin/xlint/lint1/msg_035.exp
cvs rdiff -u -r1.98 -r1.99 src/usr.bin/xlint/lint1/decl.c
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.3 src/tests/usr.bin/xlint/lint1/msg_035.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_035.c:1.3 Sat Jan 2 16:12:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_035.c Sat Jan 2 16:33:39 2021
@@ -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 @@ typedef void (example_function)(int, con
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;
Index: src/tests/usr.bin/xlint/lint1/msg_035.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_035.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_035.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_035.exp:1.3 Sat Jan 2 16:12:39 2021
+++ src/tests/usr.bin/xlint/lint1/msg_035.exp Sat Jan 2 16:33:39 2021
@@ -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]
Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.98 src/usr.bin/xlint/lint1/decl.c:1.99
--- src/usr.bin/xlint/lint1/decl.c:1.98 Sat Jan 2 03:49:25 2021
+++ src/usr.bin/xlint/lint1/decl.c Sat Jan 2 16:33:39 2021
@@ -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 @@ declarator_1_struct_union(sym_t *dsym)
/* 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.