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 tests for messages...
details: https://anonhg.NetBSD.org/src/rev/7a20e7f2f052
branches: trunk
changeset: 366728:7a20e7f2f052
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jun 11 11:20:40 2022 +0000
description:
tests/lint: add tests for messages that lack quotes
diffstat:
tests/usr.bin/xlint/lint1/msg_234.c | 6 +++---
tests/usr.bin/xlint/lint1/msg_234.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_236.c | 14 +++++++++++---
tests/usr.bin/xlint/lint1/msg_236.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_307.c | 14 +++++++++++---
tests/usr.bin/xlint/lint1/msg_307.exp | 2 +-
tests/usr.bin/xlint/lint1/msg_314.c | 19 ++++++++++++++++---
tests/usr.bin/xlint/lint1/msg_314.exp | 3 ++-
8 files changed, 46 insertions(+), 16 deletions(-)
diffs (110 lines):
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_234.c
--- a/tests/usr.bin/xlint/lint1/msg_234.c Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_234.c Sat Jun 11 11:20:40 2022 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: msg_234.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_234.c,v 1.3 2022/06/11 11:20:40 rillig Exp $ */
# 3 "msg_234.c"
// Test for message: union %s never defined [234]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* expect+1: warning: union declared_but_not_defined never defined [234] */
+union declared_but_not_defined;
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_234.exp
--- a/tests/usr.bin/xlint/lint1/msg_234.exp Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_234.exp Sat Jun 11 11:20:40 2022 +0000
@@ -1,1 +1,1 @@
-msg_234.c(6): error: syntax error ':' [249]
+msg_234.c(7): warning: union declared_but_not_defined never defined [234]
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_236.c
--- a/tests/usr.bin/xlint/lint1/msg_236.c Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_236.c Sat Jun 11 11:20:40 2022 +0000
@@ -1,7 +1,15 @@
-/* $NetBSD: msg_236.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_236.c,v 1.3 2022/06/11 11:20:40 rillig Exp $ */
# 3 "msg_236.c"
// Test for message: static function %s unused [236]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+void
+external_function(void)
+{
+}
+
+/* expect+2: warning: static function static_function unused [236] */
+static void
+static_function(void)
+{
+}
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_236.exp
--- a/tests/usr.bin/xlint/lint1/msg_236.exp Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_236.exp Sat Jun 11 11:20:40 2022 +0000
@@ -1,1 +1,1 @@
-msg_236.c(6): error: syntax error ':' [249]
+msg_236.c(13): warning: static function static_function unused [236]
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_307.c
--- a/tests/usr.bin/xlint/lint1/msg_307.c Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_307.c Sat Jun 11 11:20:40 2022 +0000
@@ -1,7 +1,15 @@
-/* $NetBSD: msg_307.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_307.c,v 1.3 2022/06/11 11:20:40 rillig Exp $ */
# 3 "msg_307.c"
// Test for message: static variable %s set but not used [307]
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* expect+1: warning: static variable set_but_not_used set but not used [307] */
+static int set_but_not_used;
+
+static int only_incremented;
+
+void function(void)
+{
+ set_but_not_used = 3;
+ only_incremented++;
+}
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_307.exp
--- a/tests/usr.bin/xlint/lint1/msg_307.exp Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_307.exp Sat Jun 11 11:20:40 2022 +0000
@@ -1,1 +1,1 @@
-msg_307.c(6): error: syntax error ':' [249]
+msg_307.c(7): warning: static variable set_but_not_used set but not used [307]
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_314.c
--- a/tests/usr.bin/xlint/lint1/msg_314.c Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_314.c Sat Jun 11 11:20:40 2022 +0000
@@ -1,7 +1,20 @@
-/* $NetBSD: msg_314.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_314.c,v 1.3 2022/06/11 11:20:40 rillig Exp $ */
# 3 "msg_314.c"
// Test for message: %s is not a structure or a union [314]
+/* This message is not used. */
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/*
+ * Added in err.c 1.20 from 2002-10-21 when adding support for C99's
+ * designated initializers, but never actually used.
+ *
+ * Instead of that message, trigger some related messages.
+ */
+void
+function(int x)
+{
+ /* expect+1: error: type 'int' does not have member 'member' [101] */
+ x->member++;
+ /* expect+1: error: type 'int' does not have member 'member' [101] */
+ x.member++;
+}
diff -r 885c8bfa402a -r 7a20e7f2f052 tests/usr.bin/xlint/lint1/msg_314.exp
--- a/tests/usr.bin/xlint/lint1/msg_314.exp Sat Jun 11 10:46:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_314.exp Sat Jun 11 11:20:40 2022 +0000
@@ -1,1 +1,2 @@
-msg_314.c(6): error: syntax error ':' [249]
+msg_314.c(17): error: type 'int' does not have member 'member' [101]
+msg_314.c(19): error: type 'int' does not have member 'member' [101]
Home |
Main Index |
Thread Index |
Old Index