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 message 160



details:   https://anonhg.NetBSD.org/src/rev/0a9b4192e920
branches:  trunk
changeset: 1017779:0a9b4192e920
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 09 15:32:06 2021 +0000

description:
lint: add test for message 160

diffstat:

 tests/usr.bin/xlint/lint1/msg_160.c   |  12 +++++++++---
 tests/usr.bin/xlint/lint1/msg_160.exp |   3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r 426e64e8e357 -r 0a9b4192e920 tests/usr.bin/xlint/lint1/msg_160.c
--- a/tests/usr.bin/xlint/lint1/msg_160.c       Sat Jan 09 15:16:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_160.c       Sat Jan 09 15:32:06 2021 +0000
@@ -1,7 +1,13 @@
-/*     $NetBSD: msg_160.c,v 1.1 2021/01/02 10:22:43 rillig Exp $       */
+/*     $NetBSD: msg_160.c,v 1.2 2021/01/09 15:32:06 rillig Exp $       */
 # 3 "msg_160.c"
 
 // Test for message: operator '==' found where '=' was expected [160]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -h */
+
+_Bool
+both_equal_or_unequal(int a, int b, int c, int d)
+{
+       /* XXX: Why shouldn't this be legitimate? */
+       return (a == b) == (c == d);
+}
diff -r 426e64e8e357 -r 0a9b4192e920 tests/usr.bin/xlint/lint1/msg_160.exp
--- a/tests/usr.bin/xlint/lint1/msg_160.exp     Sat Jan 09 15:16:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_160.exp     Sat Jan 09 15:32:06 2021 +0000
@@ -1,1 +1,2 @@
-msg_160.c(6): syntax error ':' [249]
+msg_160.c(12): warning: operator '==' found where '=' was expected [160]
+msg_160.c(12): warning: operator '==' found where '=' was expected [160]



Home | Main Index | Thread Index | Old Index