summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/msg_183.c
blob: eefef85e448faf75b294516ac4c3229ff3514eac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*	$NetBSD: msg_183.c,v 1.5 2023/07/07 19:45:22 rillig Exp $	*/
# 3 "msg_183.c"

// Test for message: illegal combination of %s '%s' and %s '%s' [183]

/* lint1-extra-flags: -X 351 */

/* expect+2: warning: argument 'x' unused in function 'example' [231] */
void *
example(double x, int i, void *vp, int *ip, double *dp, void (*fp)(void))
{
	if (i < 0)
		/* expect+1: error: function has return type 'pointer to void' but returns 'double' [211] */
		return x;

	if (i < 1)
		/* expect+1: warning: illegal combination of pointer 'pointer to void' and integer 'int' [183] */
		return i;

	if (i < 2)
		return vp;

	if (i < 3)
		return ip;

	if (i < 4)
		return dp;

	if (i < 5)
		return fp;

	return (void *)0;
}