Module Name: src
Committed By: rillig
Date: Sat Jan 30 22:07:31 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_259.c msg_259.exp
Log Message:
lint: add test for message 259 about implicit conversions
To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_259.c \
src/tests/usr.bin/xlint/lint1/msg_259.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_259.c
diff -u src/tests/usr.bin/xlint/lint1/msg_259.c:1.1 src/tests/usr.bin/xlint/lint1/msg_259.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_259.c:1.1 Sat Jan 2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.c Sat Jan 30 22:07:31 2021
@@ -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);
+}
Index: src/tests/usr.bin/xlint/lint1/msg_259.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_259.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_259.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_259.exp:1.1 Sat Jan 2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_259.exp Sat Jan 30 22:07:31 2021
@@ -1 +1 @@
-msg_259.c(6): syntax error ':' [249]
+msg_259.c(22): warning: conversion to 'int' due to prototype, arg #1 [259]