summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/msg_332.c
blob: b3d8de21f8fe05e8d8bd3ecd5d7dac67b2714cc1 (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
/*	$NetBSD: msg_332.c,v 1.6 2023/07/09 10:42:07 rillig Exp $	*/
# 3 "msg_332.c"

// Test for message: right operand of '%s' must be bool, not '%s' [332]
//
// See d_c99_bool_strict.c for many more examples.

/* lint1-extra-flags: -T -X 351 */

typedef _Bool bool;

void
test(bool);

void
example(bool b, char c, int i)
{
	test(b && b);

	/* expect+2: error: right operand of '&&' must be bool, not 'char' [332] */
	/* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */
	test(b && c);

	/* expect+2: error: right operand of '&&' must be bool, not 'int' [332] */
	/* expect+1: error: argument 1 expects '_Bool', gets passed 'int' [334] */
	test(b && i);

	test(c != '\0');
	test(i != 0);
}