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: demonstrate wrong error mess...



details:   https://anonhg.NetBSD.org/src/rev/5905ff261a42
branches:  trunk
changeset: 958699:5905ff261a42
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 17 11:32:06 2021 +0000

description:
lint: demonstrate wrong error message in strict bool mode

diffstat:

 tests/usr.bin/xlint/lint1/d_c99_bool_strict.c   |  15 ++++++++++++++-
 tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp |   1 +
 2 files changed, 15 insertions(+), 1 deletions(-)

diffs (34 lines):

diff -r 72bec2f30b7a -r 5905ff261a42 tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c     Sun Jan 17 11:28:01 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c     Sun Jan 17 11:32:06 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: d_c99_bool_strict.c,v 1.12 2021/01/16 18:48:52 rillig Exp $    */
+/*     $NetBSD: d_c99_bool_strict.c,v 1.13 2021/01/17 11:32:06 rillig Exp $    */
 # 3 "d_c99_bool_strict.c"
 
 /*
@@ -715,3 +715,16 @@
 {
        (void)(strict_bool_conversion_return_false() == 0); /* expect: 107 */
 }
+
+void
+strict_bool_assign_bit_field_then_compare(void)
+{
+       struct s {
+               bool flag: 1;
+       };
+
+       struct s s = { __lint_false };
+
+       /* FIXME: The __lint_false is converted irreversibly to an INT. */
+       (void)((s.flag = s.flag) != __lint_false); /* expect: 107 */
+}
diff -r 72bec2f30b7a -r 5905ff261a42 tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
--- a/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp   Sun Jan 17 11:28:01 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp   Sun Jan 17 11:32:06 2021 +0000
@@ -142,3 +142,4 @@
 d_c99_bool_strict.c(677): operands of '=' have incompatible types (_Bool != int) [107]
 d_c99_bool_strict.c(652): warning: argument flags unused in function strict_bool_bitwise_and_enum [231]
 d_c99_bool_strict.c(716): operands of '==' have incompatible types (_Bool != int) [107]
+d_c99_bool_strict.c(729): operands of '!=' have incompatible types (_Bool != int) [107]



Home | Main Index | Thread Index | Old Index