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: add test for '<<' in t...
details: https://anonhg.NetBSD.org/src/rev/1ec80f1afc78
branches: trunk
changeset: 959882:1ec80f1afc78
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Feb 28 01:22:02 2021 +0000
description:
tests/lint: add test for '<<' in traditional C
diffstat:
tests/usr.bin/xlint/lint1/msg_118.c | 17 ++++++++++++++---
tests/usr.bin/xlint/lint1/msg_118.exp | 2 +-
2 files changed, 15 insertions(+), 4 deletions(-)
diffs (31 lines):
diff -r 33142d5bcf8e -r 1ec80f1afc78 tests/usr.bin/xlint/lint1/msg_118.c
--- a/tests/usr.bin/xlint/lint1/msg_118.c Sun Feb 28 01:20:54 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_118.c Sun Feb 28 01:22:02 2021 +0000
@@ -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 */
+}
diff -r 33142d5bcf8e -r 1ec80f1afc78 tests/usr.bin/xlint/lint1/msg_118.exp
--- a/tests/usr.bin/xlint/lint1/msg_118.exp Sun Feb 28 01:20:54 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_118.exp Sun Feb 28 01:22:02 2021 +0000
@@ -1,1 +1,1 @@
-msg_118.c(6): syntax error ':' [249]
+msg_118.c(17): warning: semantics of '<<' change in ANSI C; use explicit cast [118]
Home |
Main Index |
Thread Index |
Old Index