summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-13.c
blob: 13e696178a7a8a27e0174b9a4f0bc7dab4fc65a3 (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
/*	$OpenBSD: test-13.c,v 1.1 2005/12/10 19:16:56 cloder Exp $	*/

/*
 * Placed in the public domain by Chad Loder <cloder@openbsd.org>.
 *
 * Test lint warnings regarding suspicious sizeof use.
 */

typedef struct bar {
	int a;
} bar_t;

/* ARGSUSED */
int
main(int argc, char *argv[])
{
	bar_t bars[10];
	unsigned int a;
	
	a = sizeof(argc + 1);	/* warn */
	a = sizeof(1);		/* warn */
	a = sizeof(bars[1]);	/* ok */
	a = sizeof(bar_t);	/* ok */

	a++;
	return 0;
}