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: add test for bool bit fields...
details: https://anonhg.NetBSD.org/src/rev/1583d9e5e673
branches: trunk
changeset: 949746:1583d9e5e673
user: rillig <rillig%NetBSD.org@localhost>
date: Fri Jan 15 23:15:28 2021 +0000
description:
lint: add test for bool bit fields as operands of '|'
diffstat:
tests/usr.bin/xlint/lint1/d_c99_bool_strict.c | 16 +++++++++++++++-
tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp | 1 +
2 files changed, 16 insertions(+), 1 deletions(-)
diffs (35 lines):
diff -r 599ade161867 -r 1583d9e5e673 tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Fri Jan 15 23:11:59 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c Fri Jan 15 23:15:28 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: d_c99_bool_strict.c,v 1.6 2021/01/15 22:07:54 rillig Exp $ */
+/* $NetBSD: d_c99_bool_strict.c,v 1.7 2021/01/15 23:15:28 rillig Exp $ */
# 3 "d_c99_bool_strict.c"
/*
@@ -529,3 +529,17 @@
i = (i, i + 1);
return b;
}
+
+void
+bit_field_as_operator_argument(void)
+{
+ struct s {
+ bool ordinary;
+ bool bit_field: 1;
+ };
+
+ struct s s = { 0 };
+
+ s.ordinary = s.ordinary | s.ordinary;
+ s.bit_field = s.bit_field | s.bit_field; /* FIXME *//* expect: 107 */
+}
diff -r 599ade161867 -r 1583d9e5e673 tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Fri Jan 15 23:11:59 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp Fri Jan 15 23:15:28 2021 +0000
@@ -101,3 +101,4 @@
d_c99_bool_strict.c(456): argument #1 expects '_Bool', gets passed 'pointer' [334]
d_c99_bool_strict.c(456): warning: illegal combination of integer (int) and pointer (pointer to const char), arg #2 [154]
d_c99_bool_strict.c(468): argument #1 expects '_Bool', gets passed 'int' [334]
+d_c99_bool_strict.c(544): operands of '=' have incompatible types (_Bool != int) [107]
Home |
Main Index |
Thread Index |
Old Index