Module Name: src
Committed By: rillig
Date: Sun Feb 28 01:22:02 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_118.c msg_118.exp
Log Message:
tests/lint: add test for '<<' in traditional C
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_118.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_118.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/msg_118.c
diff -u src/tests/usr.bin/xlint/lint1/msg_118.c:1.2 src/tests/usr.bin/xlint/lint1/msg_118.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_118.c:1.2 Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_118.c Sun Feb 28 01:22:02 2021
@@ -1,7 +1,18 @@
-/* $NetBSD: msg_118.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_118.c,v 1.3 2021/02/28 01:22:02 rillig Exp $ */
# 3 "msg_118.c"
// Test for message: semantics of '%s' change in ANSI C; use explicit cast [118]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -h */
+
+int
+int_shl_uint(int i, unsigned int u)
+{
+ return i << u;
+}
+
+unsigned
+uint_shl_ulong(unsigned a, unsigned long ul)
+{
+ return a << ul; /* expect: 118 */
+}
Index: src/tests/usr.bin/xlint/lint1/msg_118.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_118.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_118.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_118.exp:1.1 Sat Jan 2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_118.exp Sun Feb 28 01:22:02 2021
@@ -1 +1 @@
-msg_118.c(6): syntax error ':' [249]
+msg_118.c(17): warning: semantics of '<<' change in ANSI C; use explicit cast [118]