Module Name:    src
Committed By:   rillig
Date:           Sat Jun 11 10:46:38 UTC 2022

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

Log Message:
tests/lint: add test for 'previous definition' message


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_261.c \
    src/tests/usr.bin/xlint/lint1/msg_261.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_261.c
diff -u src/tests/usr.bin/xlint/lint1/msg_261.c:1.2 src/tests/usr.bin/xlint/lint1/msg_261.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_261.c:1.2	Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_261.c	Sat Jun 11 10:46:38 2022
@@ -1,7 +1,16 @@
-/*	$NetBSD: msg_261.c,v 1.2 2021/02/21 09:07:58 rillig Exp $	*/
+/*	$NetBSD: msg_261.c,v 1.3 2022/06/11 10:46:38 rillig Exp $	*/
 # 3 "msg_261.c"
 
 // Test for message: previous definition of %s [261]
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-extra-flags: -r */
+
+/* expect+2: previous definition of function [261] */
+void
+function(void)
+{
+}
+
+/* expect+2: error: redeclaration of 'function' with type 'function(void) returning int', expected 'function(void) returning void' [347] */
+/* expect+1: warning: static function function declared but not defined [290] */
+static int function(void);
Index: src/tests/usr.bin/xlint/lint1/msg_261.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_261.exp:1.2 src/tests/usr.bin/xlint/lint1/msg_261.exp:1.3
--- src/tests/usr.bin/xlint/lint1/msg_261.exp:1.2	Sun Mar 21 20:45:00 2021
+++ src/tests/usr.bin/xlint/lint1/msg_261.exp	Sat Jun 11 10:46:38 2022
@@ -1 +1,3 @@
-msg_261.c(6): error: syntax error ':' [249]
+msg_261.c(16): error: redeclaration of 'function' with type 'function(void) returning int', expected 'function(void) returning void' [347]
+msg_261.c(10): previous definition of function [261]
+msg_261.c(16): warning: static function function declared but not defined [290]

Reply via email to