xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_022.c (revision 7d62b00eb9ad855ffcd7da46b41e23feb5476fac)
1 /*	$NetBSD: msg_022.c,v 1.5 2022/10/01 09:42:40 rillig Exp $	*/
2 # 3 "msg_022.c"
3 
4 // Test for message: incomplete or misplaced function definition [22]
5 
6 /*
7  * Before decl.c 1.264 and func.c 1.130 from 2022-04-02, lint ran into
8  * assertion failures after trying to recover from the below syntax error.
9  */
10 /* expect+1: error: syntax error 'f' [249] */
11 unsigned long asdf = sizeof(int f() {});
12 
13 /* Give the parser a chance to recover. */
14 /* expect+1: warning: empty declaration [0] */
15 ;
16 
17 /*
18  * Before decl.c 1.264 and func.c 1.130 from 2022-04-02, lint ran into
19  * assertion failures after trying to recover from the below syntax error.
20  */
21 /* expect+1: error: syntax error 'param1' [249] */
22 unsigned long sz = sizeof(int(param1, param2));
23 
24 /* Give the parser a chance to recover. */
25 /* expect+1: warning: empty declaration [0] */
26 ;
27 
28 /* expect+2: error: incomplete or misplaced function definition [22] */
29 /* expect+1: warning: old-style declaration; add 'int' [1] */
30 old_style(arg);
31