summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-23.c
blob: ae88f440f79a7ad626f465b546f727e1d178012c (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*      $OpenBSD: test-23.c,v 1.1 2006/05/05 20:02:11 otto Exp $ */

/*
 * Placed in the public domain by Otto Moerbeek <otto@drijf.net>.
 *
 * Test pointer casts
 */

struct foo {
	int a;
};

void
f(void)
{
	void *vp = 0;
	char *cp = 0;
	signed char *scp = 0;
	unsigned char *ucp = 0;
	short *sp = 0;
	struct foo *fp = 0;

	vp = (void *)vp;
	vp = (void *)cp;
	vp = (void *)scp;
	vp = (void *)ucp;
	vp = (void *)sp;
	vp = (void *)fp;

	cp = (char *)vp;
	cp = (char *)cp;
	cp = (char *)ucp;
	cp = (char *)scp;
	cp = (char *)sp;
	cp = (char *)fp;

	scp = (signed char *)vp;
	scp = (signed char *)cp;
	scp = (signed char *)ucp;
	scp = (signed char *)scp;
	scp = (signed char *)sp;
	scp = (signed char *)fp;

	ucp = (unsigned char *)vp;
	ucp = (unsigned char *)cp;
	ucp = (unsigned char *)ucp;
	ucp = (unsigned char *)scp;
	ucp = (unsigned char *)sp;
	ucp = (unsigned char *)fp;

	sp = (short *)vp;
	sp = (short *)cp;
	sp = (short *)ucp;
	sp = (short *)scp;
	sp = (short *)sp;
	sp = (short *)fp;

	fp = (struct foo *)vp;
	fp = (struct foo *)cp;
	fp = (struct foo *)ucp;
	fp = (struct foo *)scp;
	fp = (struct foo *)sp;
	fp = (struct foo *)fp;

}