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 325, un...



details:   https://anonhg.NetBSD.org/src/rev/56aa05657e92
branches:  trunk
changeset: 980139:56aa05657e92
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 24 17:55:41 2021 +0000

description:
lint: add test for message 325, undefined static function

diffstat:

 tests/usr.bin/xlint/lint1/msg_225.c   |  19 ++++++++++++++++---
 tests/usr.bin/xlint/lint1/msg_225.exp |   2 +-
 2 files changed, 17 insertions(+), 4 deletions(-)

diffs (33 lines):

diff -r 4e709354751f -r 56aa05657e92 tests/usr.bin/xlint/lint1/msg_225.c
--- a/tests/usr.bin/xlint/lint1/msg_225.c       Sun Jan 24 17:44:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_225.c       Sun Jan 24 17:55:41 2021 +0000
@@ -1,7 +1,20 @@
-/*     $NetBSD: msg_225.c,v 1.1 2021/01/02 10:22:44 rillig Exp $       */
+/*     $NetBSD: msg_225.c,v 1.2 2021/01/24 17:55:41 rillig Exp $       */
 # 3 "msg_225.c"
 
 // Test for message: static function called but not defined: %s() [225]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+static void undefined(void);
+
+static void defined_later(void);
+
+void
+caller(void)
+{
+       undefined();            /* expect: 225 */
+       defined_later();
+}
+
+static void
+defined_later(void)
+{
+}
diff -r 4e709354751f -r 56aa05657e92 tests/usr.bin/xlint/lint1/msg_225.exp
--- a/tests/usr.bin/xlint/lint1/msg_225.exp     Sun Jan 24 17:44:37 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_225.exp     Sun Jan 24 17:55:41 2021 +0000
@@ -1,1 +1,1 @@
-msg_225.c(6): syntax error ':' [249]
+msg_225.c(13): static function called but not defined: undefined() [225]



Home | Main Index | Thread Index | Old Index