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



details:   https://anonhg.NetBSD.org/src/rev/a0d87b7680c5
branches:  trunk
changeset: 1022947:a0d87b7680c5
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Aug 15 13:02:20 2021 +0000

description:
tests/lint: demonstrate wrong warning about signed '>>'

Seen in libdes/ostr2key.c(81).

diffstat:

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

diffs (29 lines):

diff -r 2de124e37a4f -r a0d87b7680c5 tests/usr.bin/xlint/lint1/msg_117.c
--- a/tests/usr.bin/xlint/lint1/msg_117.c       Sun Aug 15 12:58:01 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_117.c       Sun Aug 15 13:02:20 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: msg_117.c,v 1.5 2021/04/05 01:35:34 rillig Exp $       */
+/*     $NetBSD: msg_117.c,v 1.6 2021/08/15 13:02:20 rillig Exp $       */
 # 3 "msg_117.c"
 
 // Test for message: bitwise '%s' on signed value possibly nonportable [117]
@@ -34,3 +34,11 @@
 {
        return a >> -0x1234;            /* expect: 117 *//* expect: 121 */
 }
+
+unsigned int
+shr_unsigned_char(unsigned char uc)
+{
+       /* FIXME: This value cannot actually be negative. */
+       /* expect+1: warning: bitwise '>>' on signed value possibly nonportable [117] */
+       return uc >> 4;
+}
diff -r 2de124e37a4f -r a0d87b7680c5 tests/usr.bin/xlint/lint1/msg_117.exp
--- a/tests/usr.bin/xlint/lint1/msg_117.exp     Sun Aug 15 12:58:01 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_117.exp     Sun Aug 15 13:02:20 2021 +0000
@@ -4,3 +4,4 @@
 msg_117.c(29): warning: shift amount 4660 is greater than bit-size 32 of 'int' [122]
 msg_117.c(35): warning: bitwise '>>' on signed value possibly nonportable [117]
 msg_117.c(35): warning: negative shift [121]
+msg_117.c(43): warning: bitwise '>>' on signed value possibly nonportable [117]



Home | Main Index | Thread Index | Old Index