xref: /netbsd-src/tests/usr.bin/xlint/lint1/msg_333.c (revision 82d56013d7b633d116a93943de88e08335357a7c)
1 /*	$NetBSD: msg_333.c,v 1.3 2021/03/21 14:36:59 rillig Exp $	*/
2 # 3 "msg_333.c"
3 
4 // Test for message: controlling expression must be bool, not '%s' [333]
5 //
6 // See d_c99_bool_strict.c for many more examples.
7 
8 /* lint1-extra-flags: -T */
9 
10 typedef _Bool bool;
11 
12 const char *
13 example(bool b, int i, const char *p)
14 {
15 	if (b)
16 		return "bool";
17 	if (i)			/* expect: 333 */
18 		return "int";
19 	if (p)			/* expect: 333 */
20 		return "pointer";
21 	if (__lint_false)
22 		return "bool constant"; /* expect: statement not reached */
23 	if (0)			/* expect: 333 */
24 		return "integer constant";
25 	return p + i;
26 }
27