summaryrefslogtreecommitdiff
path: root/tests/usr.bin/xlint/lint1/msg_335.c
blob: 687d648160d2bdeb6d8939fe3811376efa222211 (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
/*	$NetBSD: msg_335.c,v 1.3 2023/07/07 19:45:22 rillig Exp $	*/
# 3 "msg_335.c"

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

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

typedef _Bool bool;

void
example(bool b)
{
	/* expect+1: error: operand of '+' must not be bool [335] */
	b = +b;

	/* expect+1: error: operand of '-' must not be bool [335] */
	b = -b;

	b = !b;

	/* expect+1: error: operand of 'x++' must not be bool [335] */
	b++;

	/* expect+1: error: operand of '++x' must not be bool [335] */
	++b;

	/* expect+1: error: operand of 'x--' must not be bool [335] */
	b--;

	/* expect+1: error: operand of '--x' must not be bool [335] */
	--b;
}