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: test messages 019 and 021



details:   https://anonhg.NetBSD.org/src/rev/58b31f18c0ea
branches:  trunk
changeset: 1018343:58b31f18c0ea
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jan 31 09:48:47 2021 +0000

description:
lint: test messages 019 and 021

diffstat:

 tests/usr.bin/xlint/lint1/msg_019.c   |  13 +++++++++--
 tests/usr.bin/xlint/lint1/msg_019.exp |   7 +++++-
 tests/usr.bin/xlint/lint1/msg_021.c   |  36 ++++++++++++++++++++++++++++++++--
 tests/usr.bin/xlint/lint1/msg_021.exp |   7 +++++-
 4 files changed, 55 insertions(+), 8 deletions(-)

diffs (87 lines):

diff -r cb2fa096e5fd -r 58b31f18c0ea tests/usr.bin/xlint/lint1/msg_019.c
--- a/tests/usr.bin/xlint/lint1/msg_019.c       Sun Jan 31 09:26:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_019.c       Sun Jan 31 09:48:47 2021 +0000
@@ -1,7 +1,14 @@
-/*     $NetBSD: msg_019.c,v 1.1 2021/01/02 10:22:43 rillig Exp $       */
+/*     $NetBSD: msg_019.c,v 1.2 2021/01/31 09:48:47 rillig Exp $       */
 # 3 "msg_019.c"
 
 // Test for message: void type for %s [19]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+void global_variable;          /* expect: 19 */
+
+static void unit_variable;     /* expect: 19, 226 */
+
+void
+function(void parameter)       /* expect: 61, 231 */
+{
+       void local_variable;    /* expect: 19 */
+}
diff -r cb2fa096e5fd -r 58b31f18c0ea tests/usr.bin/xlint/lint1/msg_019.exp
--- a/tests/usr.bin/xlint/lint1/msg_019.exp     Sun Jan 31 09:26:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_019.exp     Sun Jan 31 09:48:47 2021 +0000
@@ -1,1 +1,6 @@
-msg_019.c(6): syntax error ':' [249]
+msg_019.c(6): void type for global_variable [19]
+msg_019.c(8): void type for unit_variable [19]
+msg_019.c(11): void parameter cannot have name: parameter [61]
+msg_019.c(13): void type for local_variable [19]
+msg_019.c(11): warning: argument parameter unused in function function [231]
+msg_019.c(8): warning: static variable unit_variable unused [226]
diff -r cb2fa096e5fd -r 58b31f18c0ea tests/usr.bin/xlint/lint1/msg_021.c
--- a/tests/usr.bin/xlint/lint1/msg_021.c       Sun Jan 31 09:26:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_021.c       Sun Jan 31 09:48:47 2021 +0000
@@ -1,7 +1,37 @@
-/*     $NetBSD: msg_021.c,v 1.1 2021/01/02 10:22:43 rillig Exp $       */
+/*     $NetBSD: msg_021.c,v 1.2 2021/01/31 09:48:47 rillig Exp $       */
 # 3 "msg_021.c"
 
 // Test for message: redeclaration of formal parameter %s [21]
 
-TODO: "Add example code that triggers the above message."
-TODO: "Add example code that almost triggers the above message."
+/*ARGSUSED*/
+void
+old_style_with_duplicate_parameter(parameter, parameter) /* expect: 21 */
+    int parameter;
+{                              /* expect: 32 */
+}
+
+void
+old_style_with_duplicate_parameter_declaration(parameter)
+    int parameter;
+    int parameter;             /* expect: 237 */
+{
+}
+
+void old_style_with_local_variable(parameter)
+    int parameter;
+{
+       int parameter;          /* expect: 27 */
+}
+
+/*ARGSUSED*/
+void
+prototype_with_duplicate_parameter(int param, int param) /* expect: 237 */
+{
+
+}
+
+void
+prototype_with_local_variable(int parameter)
+{
+       int parameter;          /* expect: 27 */
+}
diff -r cb2fa096e5fd -r 58b31f18c0ea tests/usr.bin/xlint/lint1/msg_021.exp
--- a/tests/usr.bin/xlint/lint1/msg_021.exp     Sun Jan 31 09:26:27 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_021.exp     Sun Jan 31 09:48:47 2021 +0000
@@ -1,1 +1,6 @@
-msg_021.c(6): syntax error ':' [249]
+msg_021.c(8): redeclaration of formal parameter parameter [21]
+msg_021.c(10): warning: argument type defaults to 'int': parameter [32]
+msg_021.c(16): redeclaration of formal parameter parameter [237]
+msg_021.c(23): redeclaration of parameter [27]
+msg_021.c(28): redeclaration of formal parameter param [237]
+msg_021.c(36): redeclaration of parameter [27]



Home | Main Index | Thread Index | Old Index