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: test bit-shift amount ...



details:   https://anonhg.NetBSD.org/src/rev/9bc2d0eb7e3c
branches:  trunk
changeset: 954428:9bc2d0eb7e3c
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Apr 09 16:37:18 2021 +0000

description:
tests/lint: test bit-shift amount equal to the type's width

diffstat:

 tests/usr.bin/xlint/lint1/msg_267.c   |  15 ++++++++++++---
 tests/usr.bin/xlint/lint1/msg_267.exp |   3 ++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 1da47f1720d9 -r 9bc2d0eb7e3c tests/usr.bin/xlint/lint1/msg_267.c
--- a/tests/usr.bin/xlint/lint1/msg_267.c       Fri Apr 09 15:58:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_267.c       Fri Apr 09 16:37:18 2021 +0000
@@ -1,7 +1,16 @@
-/*     $NetBSD: msg_267.c,v 1.2 2021/02/21 09:07:58 rillig Exp $       */
+/*     $NetBSD: msg_267.c,v 1.3 2021/04/09 16:37:18 rillig Exp $       */
 # 3 "msg_267.c"
 
 // Test for message: shift equal to size of object [267]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+int
+shr32(unsigned int x)
+{
+       return x >> 32;         /* expect: 267 */
+}
+
+int
+shl32(unsigned int x)
+{
+       return x << 32;         /* expect: 267 */
+}
diff -r 1da47f1720d9 -r 9bc2d0eb7e3c tests/usr.bin/xlint/lint1/msg_267.exp
--- a/tests/usr.bin/xlint/lint1/msg_267.exp     Fri Apr 09 15:58:43 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_267.exp     Fri Apr 09 16:37:18 2021 +0000
@@ -1,1 +1,2 @@
-msg_267.c(6): error: syntax error ':' [249]
+msg_267.c(9): warning: shift equal to size of object [267]
+msg_267.c(15): warning: shift equal to size of object [267]



Home | Main Index | Thread Index | Old Index