Module Name:    src
Committed By:   rillig
Date:           Sun Jan 17 11:32:06 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: d_c99_bool_strict.c
            d_c99_bool_strict.exp

Log Message:
lint: demonstrate wrong error message in strict bool mode


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c
cvs rdiff -u -r1.10 -r1.11 \
    src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp

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/d_c99_bool_strict.c
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.12 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.13
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c:1.12	Sat Jan 16 18:48:52 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.c	Sun Jan 17 11:32:06 2021
@@ -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 @@ strict_bool_operator_eq_bool_int(void)
 {
 	(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 */
+}

Index: src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp
diff -u src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.10 src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.11
--- src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp:1.10	Sat Jan 16 18:58:21 2021
+++ src/tests/usr.bin/xlint/lint1/d_c99_bool_strict.exp	Sun Jan 17 11:32:06 2021
@@ -142,3 +142,4 @@ d_c99_bool_strict.c(670): operands of '=
 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]

Reply via email to