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 tests/lint: fix test on platforms ...



details:   https://anonhg.NetBSD.org/src/rev/1c5d8f5057da
branches:  trunk
changeset: 1027705:1c5d8f5057da
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Dec 16 20:23:40 2021 +0000

description:
tests/lint: fix test on platforms where char is unsigned

In tree.c 1.385 from 2021-10-09, the format of the message changed.  The
test for platforms where char is unsigned was not updated in that commit
because I had forgotten about it, and because lint1/check-msgs.lua only
checks the message in tests named exacty msg_000.c, but not msg_000_*.c.

Found by martin@.

diffstat:

 tests/usr.bin/xlint/lint1/msg_230_uchar.c   |  38 ++++++++++++++--------------
 tests/usr.bin/xlint/lint1/msg_230_uchar.exp |  36 +++++++++++++-------------
 2 files changed, 37 insertions(+), 37 deletions(-)

diffs (156 lines):

diff -r 1e1786bd4006 -r 1c5d8f5057da tests/usr.bin/xlint/lint1/msg_230_uchar.c
--- a/tests/usr.bin/xlint/lint1/msg_230_uchar.c Thu Dec 16 16:30:55 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230_uchar.c Thu Dec 16 20:23:40 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_230_uchar.c,v 1.4 2021/08/28 15:25:10 rillig Exp $ */
+/*     $NetBSD: msg_230_uchar.c,v 1.5 2021/12/16 20:23:40 rillig Exp $ */
 # 3 "msg_230_uchar.c"
 
 // Test for message: nonportable character comparison, op %s [230]
@@ -19,26 +19,26 @@
 void
 compare_plain_char(char c)
 {
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== -129' [230] */
        if (c == -129)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== -128' [230] */
        if (c == -128)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== -1' [230] */
        if (c == -1)
                return;
        if (c == 0)
                return;
        if (c == 127)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== 128' [230] */
        if (c == 128)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== 255' [230] */
        if (c == 255)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== 256' [230] */
        if (c == 256)
                return;
 }
@@ -46,26 +46,26 @@
 void
 compare_plain_char_yoda(char c)
 {
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== -129' */
        if (-129 == c)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== -128' */
        if (-128 == c)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== -1' */
        if (-1 == c)
                return;
        if (0 == c)
                return;
        if (127 == c)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== 128' */
        if (128 == c)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== 255' */
        if (255 == c)
                return;
-       /* expect+1: warning: nonportable character comparison, op == [230] */
+       /* expect+1: warning: nonportable character comparison '== 256' */
        if (256 == c)
                return;
 }
@@ -74,10 +74,10 @@
 compare_lt(char c)
 {
 
-       /* expect+1: warning: nonportable character comparison, op > [230] */
+       /* expect+1: warning: nonportable character comparison '> -2' [230] */
        if (c > -2)
                return;
-       /* expect+1: warning: nonportable character comparison, op >= [230] */
+       /* expect+1: warning: nonportable character comparison '>= -1' [230] */
        if (c >= -1)
                return;
 
@@ -85,7 +85,7 @@
         * XXX: The following two comparisons have the same effect, yet lint
         * only warns about one of them.
         */
-       /* expect+1: warning: nonportable character comparison, op > [230] */
+       /* expect+1: warning: nonportable character comparison '> -1' [230] */
        if (c > -1)
                return;
        /*
@@ -105,14 +105,14 @@
         */
        if (c > 127)
                return;
-       /* expect+1: warning: nonportable character comparison, op >= [230] */
+       /* expect+1: warning: nonportable character comparison '>= 128' [230] */
        if (c >= 128)
                return;
 
-       /* expect+1: warning: nonportable character comparison, op > [230] */
+       /* expect+1: warning: nonportable character comparison '> 128' [230] */
        if (c > 128)
                return;
-       /* expect+1: warning: nonportable character comparison, op >= [230] */
+       /* expect+1: warning: nonportable character comparison '>= 129' [230] */
        if (c >= 129)
                return;
 }
diff -r 1e1786bd4006 -r 1c5d8f5057da tests/usr.bin/xlint/lint1/msg_230_uchar.exp
--- a/tests/usr.bin/xlint/lint1/msg_230_uchar.exp       Thu Dec 16 16:30:55 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_230_uchar.exp       Thu Dec 16 20:23:40 2021 +0000
@@ -1,19 +1,19 @@
-msg_230_uchar.c(23): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(26): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(29): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(36): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(39): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(42): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(50): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(53): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(56): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(63): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(66): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(69): warning: nonportable character comparison, op == [230]
-msg_230_uchar.c(78): warning: nonportable character comparison, op > [230]
-msg_230_uchar.c(81): warning: nonportable character comparison, op >= [230]
-msg_230_uchar.c(89): warning: nonportable character comparison, op > [230]
+msg_230_uchar.c(23): warning: nonportable character comparison '== -129' [230]
+msg_230_uchar.c(26): warning: nonportable character comparison '== -128' [230]
+msg_230_uchar.c(29): warning: nonportable character comparison '== -1' [230]
+msg_230_uchar.c(36): warning: nonportable character comparison '== 128' [230]
+msg_230_uchar.c(39): warning: nonportable character comparison '== 255' [230]
+msg_230_uchar.c(42): warning: nonportable character comparison '== 256' [230]
+msg_230_uchar.c(50): warning: nonportable character comparison '== -129' [230]
+msg_230_uchar.c(53): warning: nonportable character comparison '== -128' [230]
+msg_230_uchar.c(56): warning: nonportable character comparison '== -1' [230]
+msg_230_uchar.c(63): warning: nonportable character comparison '== 128' [230]
+msg_230_uchar.c(66): warning: nonportable character comparison '== 255' [230]
+msg_230_uchar.c(69): warning: nonportable character comparison '== 256' [230]
+msg_230_uchar.c(78): warning: nonportable character comparison '> -2' [230]
+msg_230_uchar.c(81): warning: nonportable character comparison '>= -1' [230]
+msg_230_uchar.c(89): warning: nonportable character comparison '> -1' [230]
 msg_230_uchar.c(99): warning: comparison of char with 0, op >= [162]
-msg_230_uchar.c(109): warning: nonportable character comparison, op >= [230]
-msg_230_uchar.c(113): warning: nonportable character comparison, op > [230]
-msg_230_uchar.c(116): warning: nonportable character comparison, op >= [230]
+msg_230_uchar.c(109): warning: nonportable character comparison '>= 128' [230]
+msg_230_uchar.c(113): warning: nonportable character comparison '> 128' [230]
+msg_230_uchar.c(116): warning: nonportable character comparison '>= 129' [230]



Home | Main Index | Thread Index | Old Index