xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_332.c (revision 039b010016da489b3c993f4814255a8bc72125df)
1 /*	$NetBSD: msg_332.c,v 1.7 2023/08/02 18:51:25 rillig Exp $	*/
2 # 3 "msg_332.c"
3 
4 // Test for message: right operand of '%s' must be bool, not '%s' [332]
5 //
6 // See d_c99_bool_strict.c for many more examples.
7 
8 /* lint1-extra-flags: -T -X 351 */
9 
10 typedef _Bool bool;
11 
12 void
13 test(bool);
14 
15 void
example(bool b,char c,int i)16 example(bool b, char c, int i)
17 {
18 	test(b && b);
19 
20 	/* expect+2: error: right operand of '&&' must be bool, not 'char' [332] */
21 	/* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */
22 	test(b && c);
23 
24 	/* expect+2: error: right operand of '&&' must be bool, not 'int' [332] */
25 	/* expect+1: error: parameter 1 expects '_Bool', gets passed 'int' [334] */
26 	test(b && i);
27 
28 	test(c != '\0');
29 	test(i != 0);
30 }
31