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