summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-14.c
blob: beace1f9f3e4637e2077c899ca2a022dc8301d61 (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
/*	$OpenBSD: test-14.c,v 1.2 2005/12/12 23:41:08 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++;
	}

	if (1.0) {			/* warn */
	}

	return 0;
}