summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-14.c
blob: a9e12daaed10cd9cf0eeaf9a6de37a461672b9e2 (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
/*	$OpenBSD: test-14.c,v 1.1 2005/12/12 23:37:51 cloder Exp $	*/

/*
 * Placed in the public domain by Chad Loder <cloder@openbsd.org>.
 *
 * Test lint warnings regarding constant in conditional contexts.
 */

/* ARGSUSED */
int
main(int argc, char *argv[])
{
	do {
		argc++;
	} while (0);			/* do not warn */

	do {
		if (argc++)
			break;
	} while (1);			/* do not warn */


	do {
		if (argc++)
			break;
	} while (2);			/* warn because of 2 */

	if (0) {			/* do not warn */
		argc++;
	}

	if (1) {			/* do not warn */
		argc++;
	}

	if (argc && 1) {		/* warn because of compound expression */
		argc++;
	}

	return 0;
}