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 test for 'previous...



details:   https://anonhg.NetBSD.org/src/rev/885c8bfa402a
branches:  trunk
changeset: 366727:885c8bfa402a
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jun 11 10:46:38 2022 +0000

description:
tests/lint: add test for 'previous definition' message

diffstat:

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

diffs (31 lines):

diff -r f3d12287acaa -r 885c8bfa402a tests/usr.bin/xlint/lint1/msg_261.c
--- a/tests/usr.bin/xlint/lint1/msg_261.c       Sat Jun 11 09:24:07 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_261.c       Sat Jun 11 10:46:38 2022 +0000
@@ -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);
diff -r f3d12287acaa -r 885c8bfa402a tests/usr.bin/xlint/lint1/msg_261.exp
--- a/tests/usr.bin/xlint/lint1/msg_261.exp     Sat Jun 11 09:24:07 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_261.exp     Sat Jun 11 10:46:38 2022 +0000
@@ -1,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]



Home | Main Index | Thread Index | Old Index