msg_249.c revision 1.9 1 /* $NetBSD: msg_249.c,v 1.9 2022/01/15 23:21:34 rillig Exp $ */
2 # 3 "msg_249.c"
3
4 // Test for message: syntax error '%s' [249]
5
6 /*
7 * Cover the grammar rule 'top_level_declaration: error T_SEMI'.
8 */
9 /* expect+1: syntax error '"' [249] */
10 "syntax error in top_level_declaration";
11
12 /* XXX: This is necessary to recover the yacc parser. */
13 int recover_from_semi;
14
15 /*
16 * Cover the grammar rule 'top_level_declaration: error T_RBRACE'.
17 */
18 /* expect+1: syntax error '"' [249] */
19 "syntax error in top_level_declaration"}
20
21 /* XXX: This is necessary to recover the yacc parser. */
22 int recover_from_rbrace;
23
24 /*
25 * Before func.c 1.110 from 2021-06-19, lint ran into this:
26 * assertion "cstmt->c_kind == kind" failed in end_control_statement
27 */
28 void
29 function(void)
30 {
31 /* expect+2: warning: statement not reached [193] */
32 if (0)
33 ;
34 ); /* expect: syntax error ')' */
35 }
36
37 /* XXX: It is unexpected that this error is not detected. */
38 "This syntax error is not detected.";
39
40 /* XXX: This is necessary to recover the yacc parser. */
41 double recover_from_rparen;
42
43 /* Ensure that the declaration after the syntax error is processed. */
44 double *
45 access_declaration_after_syntax_error(void)
46 {
47 return &recover_from_rparen;
48 }
49
50 struct cover_member_declaration {
51 /* cover 'noclass_declmods ... notype_member_decls' */
52 const noclass_declmods;
53
54 /* cover 'noclass_declspecs ...' */
55 const int noclass_declspecs;
56
57 /* cover 'add_type_qualifier_list end_type' */
58 /* expect+1: error: syntax error 'member without type' [249] */
59 const;
60 };
61