xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_239.c (revision 039b010016da489b3c993f4814255a8bc72125df)
1 /*	$NetBSD: msg_239.c,v 1.8 2023/08/02 18:51:25 rillig Exp $	*/
2 # 3 "msg_239.c"
3 
4 // Test for message: constant operand to '!' [239]
5 
6 /* lint1-extra-flags: -h -X 351 */
7 
8 _Bool
example(int n)9 example(int n)
10 {
11 	_Bool b;
12 
13 	/* expect+2: warning: constant in conditional context [161] */
14 	/* expect+1: warning: constant operand to '!' [239] */
15 	b = !0;
16 	/* expect+2: warning: constant in conditional context [161] */
17 	/* expect+1: warning: constant operand to '!' [239] */
18 	b = !1;
19 	b = !(n > 1);
20 
21 	return b;
22 }
23