Module Name:    src
Committed By:   rillig
Date:           Sun Jan 31 09:48:47 UTC 2021

Modified Files:
        src/tests/usr.bin/xlint/lint1: msg_019.c msg_019.exp msg_021.c
            msg_021.exp

Log Message:
lint: test messages 019 and 021


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_019.c \
    src/tests/usr.bin/xlint/lint1/msg_019.exp \
    src/tests/usr.bin/xlint/lint1/msg_021.c \
    src/tests/usr.bin/xlint/lint1/msg_021.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_019.c
diff -u src/tests/usr.bin/xlint/lint1/msg_019.c:1.1 src/tests/usr.bin/xlint/lint1/msg_019.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_019.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_019.c	Sun Jan 31 09:48:47 2021
@@ -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 */
+}
Index: src/tests/usr.bin/xlint/lint1/msg_019.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_019.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_019.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_019.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_019.exp	Sun Jan 31 09:48:47 2021
@@ -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]
Index: src/tests/usr.bin/xlint/lint1/msg_021.c
diff -u src/tests/usr.bin/xlint/lint1/msg_021.c:1.1 src/tests/usr.bin/xlint/lint1/msg_021.c:1.2
--- src/tests/usr.bin/xlint/lint1/msg_021.c:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_021.c	Sun Jan 31 09:48:47 2021
@@ -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 */
+}
Index: src/tests/usr.bin/xlint/lint1/msg_021.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_021.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_021.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_021.exp:1.1	Sat Jan  2 10:22:43 2021
+++ src/tests/usr.bin/xlint/lint1/msg_021.exp	Sun Jan 31 09:48:47 2021
@@ -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]

Reply via email to