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 declarati...



details:   https://anonhg.NetBSD.org/src/rev/4aa16046c714
branches:  trunk
changeset: 953768:4aa16046c714
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Mar 20 14:13:51 2021 +0000

description:
tests/lint: add test for declaration after statement

diffstat:

 tests/usr.bin/xlint/lint1/msg_327.c   |  23 +++++++++++++++++++----
 tests/usr.bin/xlint/lint1/msg_327.exp |   5 ++++-
 2 files changed, 23 insertions(+), 5 deletions(-)

diffs (39 lines):

diff -r a7f85c58ad7a -r 4aa16046c714 tests/usr.bin/xlint/lint1/msg_327.c
--- a/tests/usr.bin/xlint/lint1/msg_327.c       Sat Mar 20 13:53:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_327.c       Sat Mar 20 14:13:51 2021 +0000
@@ -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] */
+
+/* lint1-flags: -w */
+
+void statement(void);
 
-TODO: "Add example code that triggers the above message." /* expect: 249 */
-TODO: "Add example code that almost triggers the above message."
+/*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 */
diff -r a7f85c58ad7a -r 4aa16046c714 tests/usr.bin/xlint/lint1/msg_327.exp
--- a/tests/usr.bin/xlint/lint1/msg_327.exp     Sat Mar 20 13:53:28 2021 +0000
+++ b/tests/usr.bin/xlint/lint1/msg_327.exp     Sat Mar 20 14:13:51 2021 +0000
@@ -1,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]



Home | Main Index | Thread Index | Old Index