xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_183.c (revision 3117ece4fc4a4ca4489ba793710b60b0d26bab6c)
1 /*	$NetBSD: msg_183.c,v 1.6 2023/07/09 11:18:55 rillig Exp $	*/
2 # 3 "msg_183.c"
3 
4 // Test for message: illegal combination of %s '%s' and %s '%s' [183]
5 
6 /* lint1-extra-flags: -X 351 */
7 
8 /* expect+2: warning: parameter 'x' unused in function 'example' [231] */
9 void *
10 example(double x, int i, void *vp, int *ip, double *dp, void (*fp)(void))
11 {
12 	if (i < 0)
13 		/* expect+1: error: function has return type 'pointer to void' but returns 'double' [211] */
14 		return x;
15 
16 	if (i < 1)
17 		/* expect+1: warning: illegal combination of pointer 'pointer to void' and integer 'int' [183] */
18 		return i;
19 
20 	if (i < 2)
21 		return vp;
22 
23 	if (i < 3)
24 		return ip;
25 
26 	if (i < 4)
27 		return dp;
28 
29 	if (i < 5)
30 		return fp;
31 
32 	return (void *)0;
33 }
34