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 lint: add test for message 259 abo...
details: https://anonhg.NetBSD.org/src/rev/01077409c3c8
branches: trunk
changeset: 959066:01077409c3c8
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jan 30 22:07:31 2021 +0000
description:
lint: add test for message 259 about implicit conversions
diffstat:
tests/usr.bin/xlint/lint1/msg_259.c | 23 ++++++++++++++++++++---
tests/usr.bin/xlint/lint1/msg_259.exp | 2 +-
2 files changed, 21 insertions(+), 4 deletions(-)
diffs (37 lines):
diff -r 4c52bea50658 -r 01077409c3c8 tests/usr.bin/xlint/lint1/msg_259.c
--- a/tests/usr.bin/xlint/lint1/msg_259.c Sat Jan 30 21:58:04 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.c Sat Jan 30 22:07:31 2021 +0000
@@ -1,7 +1,24 @@
-/* $NetBSD: msg_259.c,v 1.1 2021/01/02 10:22:44 rillig Exp $ */
+/* $NetBSD: msg_259.c,v 1.2 2021/01/30 22:07:31 rillig Exp $ */
# 3 "msg_259.c"
// Test for message: conversion to '%s' due to prototype, arg #%d [259]
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -h */
+
+void farg_char(char);
+void farg_int(int);
+void farg_long(long);
+
+void
+example(char c, int i, long l)
+{
+ farg_char(c);
+ farg_int(c);
+ farg_long(c);
+ farg_char(i); /* XXX: why no warning? */
+ farg_int(i);
+ farg_long(i);
+ farg_char(l); /* XXX: why no warning? */
+ farg_int(l); /* expect: 259 */
+ farg_long(l);
+}
diff -r 4c52bea50658 -r 01077409c3c8 tests/usr.bin/xlint/lint1/msg_259.exp
--- a/tests/usr.bin/xlint/lint1/msg_259.exp Sat Jan 30 21:58:04 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_259.exp Sat Jan 30 22:07:31 2021 +0000
@@ -1,1 +1,1 @@
-msg_259.c(6): syntax error ':' [249]
+msg_259.c(22): warning: conversion to 'int' due to prototype, arg #1 [259]
Home |
Main Index |
Thread Index |
Old Index