summaryrefslogtreecommitdiff
path: root/regress/usr.bin/xlint/test-12.c
blob: 0dd7450fe9577d233f7647c1b4bb4869160cd246 (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
/*	$OpenBSD: test-12.c,v 1.2 2005/12/10 19:20:21 cloder Exp $	*/

/*
 * Placed in the public domain by Chad Loder <cloder@openbsd.org>.
 *
 * Test lint warnings regarding assignment in conditional context.
 */
#include <limits.h>

/* ARGSUSED */
int
main(int argc, char *argv[])
{
	int a = 0;

	if (a = argc)		/* should warn */
		return 1;

	a++;

	if ((a = argc))		/* should not warn */
		return 1;

	for (a = 0; a < 10; a++)
		a = a;

	return 0;
}