Module Name: src
Committed By: rillig
Date: Sat Mar 20 14:13:51 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_327.c msg_327.exp
Log Message:
tests/lint: add test for declaration after statement
To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/usr.bin/xlint/lint1/msg_327.c
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint1/msg_327.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_327.c
diff -u src/tests/usr.bin/xlint/lint1/msg_327.c:1.2 src/tests/usr.bin/xlint/lint1/msg_327.c:1.3
--- src/tests/usr.bin/xlint/lint1/msg_327.c:1.2 Sun Feb 21 09:07:58 2021
+++ src/tests/usr.bin/xlint/lint1/msg_327.c Sat Mar 20 14:13:51 2021
@@ -1,7 +1,22 @@
-/* $NetBSD: msg_327.c,v 1.2 2021/02/21 09:07:58 rillig Exp $ */
+/* $NetBSD: msg_327.c,v 1.3 2021/03/20 14:13:51 rillig Exp $ */
# 3 "msg_327.c"
-// Test for message: declarations after statements is a C9X feature [327]
+/* Test for message: declarations after statements is a C9X feature [327] */
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/* lint1-flags: -w */
+
+void statement(void);
+
+/*ARGSUSED*/
+void
+example(void)
+{
+ statement();
+ int declaration_1; /* FIXME: expect 327 */
+ statement();
+ int declaration_2; /* expect: 327 */
+ statement();
+ int declaration_3; /* expect: 327 */
+} /*FIXME*//* expect: syntax error '}' */
+
+/*FIXME*//* expect+1: cannot recover */
Index: src/tests/usr.bin/xlint/lint1/msg_327.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_327.exp:1.1 src/tests/usr.bin/xlint/lint1/msg_327.exp:1.2
--- src/tests/usr.bin/xlint/lint1/msg_327.exp:1.1 Sat Jan 2 10:22:44 2021
+++ src/tests/usr.bin/xlint/lint1/msg_327.exp Sat Mar 20 14:13:51 2021
@@ -1 +1,4 @@
-msg_327.c(6): syntax error ':' [249]
+msg_327.c(17): warning: declarations after statements is a C9X feature [327]
+msg_327.c(19): warning: declarations after statements is a C9X feature [327]
+msg_327.c(20): syntax error '}' [249]
+msg_327.c(23): cannot recover from previous errors [224]