Module Name: src
Committed By: rillig
Date: Thu Jul 8 18:02:22 UTC 2021
Modified Files:
src/tests/usr.bin/xlint/lint1: msg_249.c msg_249.exp
Log Message:
tests/lint: add test coverage for some parse errors
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/xlint/lint1/msg_249.c \
src/tests/usr.bin/xlint/lint1/msg_249.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_249.c
diff -u src/tests/usr.bin/xlint/lint1/msg_249.c:1.3 src/tests/usr.bin/xlint/lint1/msg_249.c:1.4
--- src/tests/usr.bin/xlint/lint1/msg_249.c:1.3 Sat Jun 19 16:05:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_249.c Thu Jul 8 18:02:22 2021
@@ -1,9 +1,27 @@
-/* $NetBSD: msg_249.c,v 1.3 2021/06/19 16:05:07 rillig Exp $ */
+/* $NetBSD: msg_249.c,v 1.4 2021/07/08 18:02:22 rillig Exp $ */
# 3 "msg_249.c"
// Test for message: syntax error '%s' [249]
/*
+ * Cover the grammar rule 'top_level_declaration: error T_SEMI'.
+ */
+/* expect+1: syntax error '"' [249] */
+"syntax error in top_level_declaration";
+
+/* XXX: This is necessary to recover the yacc parser. */
+int recover_from_semi;
+
+/*
+ * Cover the grammar rule 'top_level_declaration: error T_RBRACE'.
+ */
+/* expect+1: syntax error '"' [249] */
+"syntax error in top_level_declaration"}
+
+/* XXX: This is necessary to recover the yacc parser. */
+int recover_from_rbrace;
+
+/*
* Before func.c 1.110 from 2021-06-19, lint ran into this:
* assertion "cstmt->c_kind == kind" failed in end_control_statement
*/
@@ -14,3 +32,6 @@ function(void)
;
); /* expect: syntax error ')' */
}
+
+/* XXX: This is necessary to recover the yacc parser. */
+int recover_from_rparen;
Index: src/tests/usr.bin/xlint/lint1/msg_249.exp
diff -u src/tests/usr.bin/xlint/lint1/msg_249.exp:1.3 src/tests/usr.bin/xlint/lint1/msg_249.exp:1.4
--- src/tests/usr.bin/xlint/lint1/msg_249.exp:1.3 Sat Jun 19 16:05:07 2021
+++ src/tests/usr.bin/xlint/lint1/msg_249.exp Thu Jul 8 18:02:22 2021
@@ -1 +1,3 @@
-msg_249.c(15): error: syntax error ')' [249]
+msg_249.c(10): error: syntax error '"' [249]
+msg_249.c(19): error: syntax error '"' [249]
+msg_249.c(33): error: syntax error ')' [249]